API
Admin Resources

Token information

This resource allows a caller to inspect basic information regarding the token in use. It will only return a single object related to the calling token ( ie - a call with api_token.id=1 will only return information regarding api_token.id=1.

4 additions in V2, marked New

Everything marked New also works when you send X-Recharge-Version: 2021-11.

#The token information object

Details of the client which generated the token.
If the API token was generated by an OAuth app, the object will contain associated client information.
If the API token was generated by the merchant, the object will reflect the name prefaced by '[Private App]' and contact_email of the token.

Attributes

  • clientobject
    An object containing information about the client associated with the API Token. Present for every token; name and contact_email are null when the token has no client.
    Show child attributesHide child attributes21 new
  • The email associated with the API Token record.
    For tokens created via OAuth App the contact can be null
  • created_by_emailstring · nullableNew
    The email of the user on whose behalf the token was issued. null for API tokens created by a merchant or an OAuth app.
  • created_by_user_idinteger · nullableNew
    The unique numeric identifier of the user on whose behalf the token was issued. null for API tokens created by a merchant or an OAuth app.
  • namestring
    The name of the API Token as created by merchant.
  • scopesarray
    A list of scopes on the API Token.
The token information object
{
  "client": {
    "name": "PARTNER",
    "contact_email": "ed@partner.com"
  },
  "contact_email": "jbluhm@example.com",
  "created_by_email": null,
  "created_by_user_id": null,
  "name": "token name",
  "scopes": [
    "read_shop",
    "write_payments"
  ]
}

#Retrieve token information

GET/token_information
Retrieve token details.
GET/token_information
curl 'https://api.rechargeapps.com/token_information' \
  -H 'X-Recharge-Version: v2' \
  -H 'X-Recharge-Access-Token: your_api_token'
Response
{
  "token_information": {
    "client": {
      "name": "PARTNER",
      "contact_email": "ed@partner.com"
    },
    "contact_email": "jbluhm@example.com",
    "created_by_email": null,
    "created_by_user_id": null,
    "name": "token name",
    "scopes": [
      "read_store",
      "write_payment_methods"
    ]
  }
}

#Rotate the current tokenNew

POST/token_information/rotate
Replaces the API token used to make the request with a new token that has the same name, scopes and expiry. The previous token keeps working for the grace period and then expires. The new token value is returned only in this response. Only API tokens created by a merchant in the Recharge admin can be rotated, and the endpoint is only available on stores where expiring API tokens are enabled (otherwise 404).

Body parameters

  • Number of seconds the previous token remains valid after rotation. Must be between 0 and 604800 (7 days). Defaults to 86400 (24 hours); 0 expires the previous token immediately.
POST/token_information/rotate
curl -X POST 'https://api.rechargeapps.com/token_information/rotate' \
  -H 'X-Recharge-Version: v2' \
  -H 'X-Recharge-Access-Token: your_api_token'
Response
{
  "token": {
    "id": 70213,
    "name": "Warehouse sync",
    "access_token": "sk_1x1_0f3c9d1e5b7a4c2e8f6a0b1c2d3e4f5a6b7c8d9e0f1a2b3c4d5e6f7a8b9c0d1e",
    "access_token_hint": "sk_1x1_...0d1e",
    "scopes": [
      "read_orders",
      "write_orders"
    ],
    "expires_at": "2126-08-21T14:03:55Z"
  },
  "rotated_token": {
    "id": 69877,
    "access_token_hint": "sk_1x1_...a41c",
    "expires_at": "2026-09-15T14:03:55Z"
  }
}