webhooks/v1/tokens
Sets a secret token to verify the authenticity of webhook payloads.
When a webhook event occurs, the service calculates a hash signature using the token and includes it in the event notification. The receiving application listening at the callback URL can verify the payload’s integrity by comparing the calculated signature to the one received.
The webhooks affected by this operation are determined by the type of access token you use.
- Two-legged Access Token: Sets the secret token for all webhooks owned by calling the app.
- Three-legged Access Token: Sets the secret token for all webhooks owned by the calling user
Note: Use the Update Webhook operation to set a token for a specific webhook.
See the Secret Token section in API Basics for more information.
Resource Information
| Method and URI | POST https://developer.api.autodesk.com/webhooks/v1/tokens |
| Authentication Context | User context optional |
| Required OAuth Scopes | data:read data:write |
| Data Format | JSON |
Request
Headers
| Authorization* string | Must be Bearer <token>, where <token> is a two-legged access token obtained via a Client Credentials Grant flow, or a three-legged access token obtained via an Authorization Code flow or a Secure Service Account (SSA) flow.
The SSA flow is designed for headless server-to-server operations. While it functions like a two-legged flow (no user interaction), it is classified as three-legged because it preserves user context. |
| region string | The geographical location (region) of the server the request must be executed on. This also corresponds to the region where Webhook data is stored. It is also the location of the server that will make requests to your callback URL. Possible values:
Note: You can specify the region using three methods: the |
| x-ads-region string | The geographical location (region) of the server the request must be executed on. This also corresponds to the region where Webhook data is stored. It is also the location of the server that will make requests to your callback URL. Possible values:
Note: You can specify the region using three methods: the |
| Content-Type* string | Must be application/json |
Request
Query String Parameters
| region enum:string | The geographical location (region) of the server the request must be executed on. This also corresponds to the region where Webhook data is stored. It is also the location of the server that will make request to your callback URL. Possible values:
Note: You can specify the region using three methods: the |
Request
Body Structure
The request payload for a Create Secret request
| token* string | The new secret to set. |
Response
HTTP Status Code Summary
| 200 OK | The secret was set successfully. |
| 400 Bad Request | Returned when a secret token already exists for this application. Use the Update Secret Token operation to replace it instead. |
| 401 Unauthorized | The supplied authorization header was invalid or the token scope was not acceptable. Verify your authentication credentials and try again. |
| 403 Forbidden | The request was valid but lacked the necessary permissions. Verify your credentials and permissions before sending the request again. |
| 404 Not Found | The requested resource could not be found on the server. Review the request and try again. |
| 500 Internal Server Error | An unexpected error occurred on the server. Please try again later. |
Response
Body Structure (200)
| status number | A repetition of the HTTP status code returned in the response headers, which indicates the outcome of the request. |
| detail array: string | An array of strings, where each string is a human-readable description of the request’s outcome. |
Example
This example demonstrates how to create a secret token.
Request
curl -X 'POST'\
-v 'https://developer.api.autodesk.com/webhooks/v1/tokens'\
-H 'Content-Type: application/json'\
-H 'authorization: Bearer eyJhbGciOiJIUzI1NiIsImtpZCI6Imp3dF9zeW1tZX'\
-d '{
"token":"awffbvdb3trf4fvdfbUyt39suHnbe5Mnrks3"
}'
Response
HTTP/1.1 200
Date: Fri, 15 Sep 2017 19:11:00 GMT
Content-Length: 0
Connection: keep-alive
{
"status": 200,
"detail": [
"Token created successfully for client: *****"
]
}