V2 Get Token REST Service for OAuth Authentication
GET https://<hostname>/ws/rest/service/v2/auth/token
Purpose
Use this rest service with your credentials to fetch a JWT token to access V2 REST services. The token is valid for date/time available in the response. The token expiration is set to 3600 seconds by default.
Request Format
Send an API request for a token with the end point URL included in the following curl command.
curl --location --request GET 'http://<HOST_NAME/ws/rest/service/v2/auth/token' \
--header 'Authorization: Bearer XXXXXXX'
Note: If the endpoint URL has a project number that contains special characters such as / \ : * ? " < > or |, you must change those special characters to URL escape characters. For example, A project number with a special number sign (hash) such as 2020#7 must be changed to 2020%7. You can use a browser to access the list of URL escape characters.
Optional Request Parameter
Use the following parameter to modify the token expiration in the API request:
Request Parameter | Data Type | Description |
---|---|---|
Expiry | string | Enter the optional token expiration duration in seconds. For example, expiry=300. |
Sample Success Response
This is an example of a successful response to a request.
{
"data": {
"access_token": "eyJ4NXQjUzI1NiI6IjN2dFl1OU04ejFJSWlieDI2c2k1b2J1ekZ4RlBlRFpTcmhjX01kcHpjcE0iLCJ4NXQiOiItZlVTYTJVeGNzRGxJUzBxbHRrT3c5cEtyNlUiLCJraWQiOiJTSUdOSU5HX0tFWSIsImFsZyI6IlJTMjU2In0.eyJjbGllbnRfb2NpZCI6Im9jaWQxLmRvbWFpbmFwcC5vYzEuaWFkLmFtYWFhYWFhYXF0cDViYWE1Z3Rwd25zbW5nbjY1eGdmcTIyZ3hsamFpeHpidWp3ZmVpNTY0Zmp5YjduYSIsInVzZX",
"expires_in": 3600,
"token_type": "Bearer",
"auth_type": "oAuth"
},
"message": [],
"status": 200
}
Supported Response Parameters for OAuth Authentication
The following parameters display with values in the response output:
Response Parameter | Data Type | Description |
---|---|---|
access_token | string | Displays the bearer token. |
expires_in | string | Displays the expiry duration in seconds. By default, 3600 seconds. |
token_type | string | Displays the Bearer token type. |
auth_type | string | Displays the authentication type used by the integration user. Choices include: Basic, and OAuth. |
message | string | Displays the error message. |
status | string | Displays the http status code. |
Supported HTTP Status Codes
The following HTTP status codes are supported for this rest service:
HTTP Status Code | Status Message | Error Message |
---|---|---|
200 | Success | not applicable. |
400 | Bad Request | Invalid expiry. |
401 | Unauthorized | Empty or Invalid Authorization Header. Invalid Authorization Header |
500 | Internal Server Error | Please contact Administator with Diagnostic code. |
Related Topics
Setting Up Integration Users with OAuth Authentication
V1 Get Token REST Service for OAuth Authentication
Last Published Tuesday, July 1, 2025