Create token - Grasshopper Labs API
Tokens

Create token

Exchange API user credentials for a bearer access token plus a refresh token.

POST /api/token/

Body parameters

email
string Required
The API user's email address.
password
string Required
The API user's password.

Example

curl -X POST https://{licensee-url}/api/token/ \
  -H "Content-Type: application/json" \
  -d '{
    "email": "api@your-company.com",
    "password": "your-api-password"
  }'
const res = await fetch('https://{licensee-url}/api/token/', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    email: 'api@your-company.com',
    password: 'your-api-password'
  })
});
const { token, refresh_token } = await res.json();
import requests

res = requests.post(
    'https://{licensee-url}/api/token/',
    json={
        'email': 'api@your-company.com',
        'password': 'your-api-password'
    }
)
token = res.json()['token']
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
  "refresh_token": "rfsh_abc123...",
  "expires_in": 3600,
  "token_type": "Bearer"
}
Try it out
Response will appear here

Errors

Statuserror.codeCause
401invalid_credentialsEmail or password incorrect.
429rate_limit_exceededToo many token requests. Wait and retry.