Monetate Auth API
Token

Refresh a Token

GET
https://api.monetate.net/api/auth/v0/refresh/

Request to refresh a token for use in token authentication.

This endpoint has no request body, but requires authentication using a signed JWT. For example, in Python using the PyJWT library:

import jwt
import requests
import time

private_key = "== SECRET RSA KEY =="

payload = jwt.encode({
    'username': 'api-xxx-yourname',
    'iat': time.time()
}, private_key, algorithm='RS256')

authorization = "JWT {}".format(payload)
requests.get(refresh_url, headers={'Authorization': authorization})

The JWT should contain the username associated with the key and the creation time. The private key must be associated with an uploaded, active public key. The JWT must be encoded with one of the following algorithms:

  • RS256
  • RS384
  • RS512

Issuing this request provides a token which is valid until the indicated expiration time. The default time until expiration (of 1 hour) can be manually set by passing a ttl query parameter with the request. Valid values are in the inclusive range of 15 minutes to 12 hours.

Issuing this request does not cause any previously issued tokens to expire, they will continue to function.

To revoke a token prior to expiration, you must deactivate the public key associated with the token.

Authentication
Authorization
Query Parameters
ttl
Responses
200
The token was successfully generated.
meta
*
data
*
401
Unauthorized. The request did not include a token, or the token provided was invalid. Please ensure that your token is correct and that the Authorization header is properly formatted.
meta
*
data
*
403
Forbidden. The request included a token that has been revoked. Please contact your account administrator to generate a new token.
meta
*
data
*
500
Unknown error. Please try again or contact your account manager for more information.
meta
*
data
*