Access Token

Detailed description on managing your access token required to use the RudderStack Transformation API.

To consume the RudderStack Transformation API you need access to it. This guide details the steps required to generate an access token and the operations associated with it.

Operations on the Access Token

In order to use the Transformation API, you will need an Access Token associated with your account. You can create your own Access Token by following steps below:

You can use Postman, Fiddler or any other API client to make your request.

Use HTTP Basic authentication and pass the workspace token as the user name and empty string as password.

post
Generate Access Token

https://api.rudderstack.com/accessTokens
Generates a new access token.
Request
Response
Request
Headers
Authorisation
required
string
Base64encoded workspace token to generate your access token.
Body Parameters
name
required
string
Name of access token
Response
200: OK
{
"success": true,
"data": {
"token": "1pHxUIA3jmxS2ip01zY696F80j7"
}
}

A sample request is as shown:

Curl
Httpie
Curl
curl --location -X POST 'https://api.rudderstack.com/accessTokens' \
-H 'Authorization: Basic Base64Enc(workspacetoken:)' \
-H 'Content-Type: application/json' \
-d '{
"name": "some-test-access-token",
"description": "some-description"
}'
Httpie
http POST 'https://api.rudderstack.com/accessTokens' \
name=some-test-access-token description=some-description \
Authorization:'Basic MXBUbGc2MlpZcUgycWtDMDVmc1hUZlJQRWZyOg==' \
Content-Type:'application/json'

We use Basic Auth consisting of three parts:

  • Basic

  • Base64Encoded(Token)

  • Token = workspace token + colon

You can get the workspace token by logging into your RudderStack dashboard, as shown:

An example is as shown :

  • Workspace Token - abcd1234

  • Headers - Basic {Base64Encoded(abcd1234:)}

Copy your access token and keep it safely with you. You won't be able to get it back once lost. Your AccessToken carry many privileges, so be sure to keep them secret.

get
List all Access Tokens

https://api.rudderstack.com/accessTokens
Get all access tokens associated with a workspace.
Request
Response
Request
Headers
required
string
Base64encoded workspace token.
Response
200: OK
[
{
"name": "Access Token 1",
"description": "",
"userId": "1pTjNPbjnUy6nlWZH78FtcTtBtD"
},
{
"name": "Access Token 2",
"description": "number 2",
"userId": "1pTjNPbjnUy6nlWZH78FtcTtBtD"
},
]

Here you will get a list of objects. Note that RudderStack does not send your access token.

Curl
Httpie
Curl
curl --location -X GET 'https://api.rudderstack.com/accessTokens' \
-H 'Authorization: Basic MXBUbGc2MlpZcUgycWtDMDVmc1hUZlJQRWZyOg==' \
Httpie
http GET 'https://api.rudderstack.com/accessTokens' \
'Authorization: Basic Base64Enc(workspacetoken:)'

delete
Delete access token

https://api.rudderstack.com/accessTokens
Delete an access token by name.
Request
Response
Request
Path Parameters
Authorization
required
string
Base64encoded workspace token.
Query Parameters
name
required
string
Name of the access token to delete
Response
200: OK
All access token will be deleted with given name.
{
success: true
}
Curl
Httpie
Curl
curl --location -X DELETE 'https://api.rudderstack.com/accessTokens?name=some-test-access-token' \
-H 'Authorization: Basic MXBUbGc2MlpZcUgycWtDMDVmc1hUZlJQRWZyOg==' \
Httpie
http DELETE 'http://api.rudderstack.com/accessTokens?name=sdc' \
'Authorization: Basic Base64Enc(workspacetoken:)'

Errors

RudderStack uses standard HTTP response codes to indicate the success or failure of an API request.

Http Response Code

Description

200 - OK

Everything worked as expected.

400 - Bad Request

The request was unacceptable. This often happens due to a missing required field.

401 – Unauthorized

No valid Access Token was provided, or the user does not have the required access to the resource.

403 – Forbidden

User does not have the permission to create or access the data.

404 - Not Found

The requested resource does not exist.

500 - Internal Server Error

Something went wrong on RudderStack's end.

Contact Us

For more information on the access tokens, or if face any issues related to accessing it, you can contact us or you can also start a conversation on our Slack channel.