Create partner token
POST
/dr/v1/auth/token
const url = 'https://sender.sandbox-api.kivra.com/dr/v1/auth/token';const options = { method: 'POST', headers: {'Content-Type': 'application/x-www-form-urlencoded'}, body: new URLSearchParams({ grant_type: 'client_credentials', client_id: 'example', client_secret: 'example' })};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://sender.sandbox-api.kivra.com/dr/v1/auth/token \ --header 'Content-Type: application/x-www-form-urlencoded' \ --data grant_type=client_credentials \ --data client_id=example \ --data client_secret=exampleRequires client_id and client_secret.
The returned partner token is sufficient on its own: it can create and manage all of your chains and stores and send receipts for any store. For most integrations this is the only token you need — scoping down to a chain or store token is optional (see the /dr/v1/auth/token/chain/{chainID} and /dr/v1/auth/token/store/{storeID} endpoints).
Request Body
Section titled “Request Body”Media typeapplication/x-www-form-urlencoded
object
grant_type
required
string
client_id
required
string
client_secret
required
string
Responses
Section titled “Responses”Token successfully created
Media typeapplication/json
TokenResponse
object
access_token
string
token_type
string
expires_in
Expiration time in seconds
integer
Example
{ "access_token": "<JWT token>", "token_type": "Bearer", "expires_in": 86000}Bad request
Media typeapplication/json
ErrorResponse
object
error_code
string
short_message
string
long_message
string
error_detail
Array<string>
Examples
{ "error_code": "40000", "short_message": "bad request", "long_message": "body s missing required fields or has invalid fields"}{ "error_code": "40002", "short_message": "bad request", "long_message": "missing required header or invalid header"}Unauthorized
Media typeapplication/json
ErrorResponse
object
error_code
string
short_message
string
long_message
string
error_detail
Array<string>
Examples
Exampleunauthorized
{ "error_code": "40100", "short_message": "unauthorized", "long_message": "permission denied"}Internal server error
Media typeapplication/json
ErrorResponse
object
error_code
string
short_message
string
long_message
string
error_detail
Array<string>
Example
{ "error_code": "50000", "short_message": "internal server error", "long_message": "unknown error ocurred"}