service-accounts
Creates a service account. Only a server-to-server application can own service accounts.
An application can have up to 10 service accounts at any given time.
Upon a successful response, the operation returns the service account ID and email address.
Resource Information
Method and URI | POST https://developer.api.autodesk.com/authentication/v2/service-accounts |
Authentication Context | app only |
Required OAuth Scopes | application:service_account:write |
Data Format | JSON |
Request
Headers
Authorization* string | Must be Bearer <token> , where <token> is obtained via OAuth |
Content-Type* string | Must be application/json |
Request
Body Structure
name* string | The name of the service account. Must be 5-100 characters long, contain only alphanumeric characters and dashes, and include at least one alphanumeric character. |
firstName* string | The first name of the service account. For display purposes only.
Must meet the following conditions:
For more information, see Naming Guidelines. |
lastName* string | The last name of the service account. For display purposes only.
Must meet the following conditions:
For more information, see Naming Guidelines. |
Response
HTTP Status Code Summary
201 Created | The service account was successfully created. |
400 Bad Request | The request was invalid due to one or more of the following issues:
Please correct the identified issues and resubmit the request. The response body may provide more details. |
401 Unauthorized | The access token is invalid. It may have either expired or may not be a two-legged access token. Please verify the token and retry the request. |
403 Forbidden | The provided Client ID is wrong or the number of service accounts that the application can have has reached the limit. Please verify the Client ID. If you’ve reached the limit, delete unused service accounts to create capacity. |
500 Internal Server Error | An unknown server-side error occurred. Please try again later. If the problem persists, please contact support. |
Response
Body Structure (201)
serviceAccountId string | The Autodesk ID of the service account. |
email string | The email address of the service account. It is of the form <serviceAccountName>@<clientID>.adskserviceaccount.autodesk.com . |
Example 1
This example illustrates the successful creation of a service account.
Request
curl \
--location 'https://developer.api.autodesk.com/authentication/v2/service-accounts' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer eyJh...' \
--header 'Content-Type: application/json' \
--data '{
"name": "acmeeurope-sales-reports",
"firstName" : "EUROPE",
"lastName" : "ACME"
}'
Response (201)
{
"serviceAccountId":"6BNJQT7RR7GTJ5QY",
"email":"acmeeurope-sales-reports@Ycw2Usv4XY38AfkvTIJTtEUVx8xNUORpJm31IILNtPvTXwGu.adskserviceaccount.com"
}
Example 2
This example illustrates what happens when you try to create an account with a name that already exists.
Request
curl \
--location 'https://developer.api.autodesk.com/authentication/v2/service-accounts' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer eyJh...' \
--header 'Content-Type: application/json' \
--data '{
"name": "acmeeurope-sales-reports",
"firstName" : "EUROPE",
"lastName" : "ACME"
}'
Response (400)
{
"title": "invalid_request",
"detail": "The 'name' already exists."
}