User API (v8.0)¶
Success
You're currently viewing the latest version of the User API (UAPI).
Authentication¶
Basic Auth¶
Using basic authentication is the easiest way to get started with our API. However, keep in mind that the API credentials that are generated for basic authentication give full access to your entire account, just as if you were logged into the control panel.
If you plan to distribute an application using our API, or allow more than one user access to the tool you’re building, please use OAuth. This is the more secure alternative as it allows you to restrict what your application can do while authenticated to your account.
Invalidating tokens / api keys¶
When you generate a new api key in ComputeStacks, any previously generated tokens will be immediately invalidated.
OAuth2¶
Our OAuth2 endpoint supports the following grant types:
Authorization CodePassword- Same API credentials used
basic auth, not your normal login credentials.
- Same API credentials used
Client Credentials- Only has access to API methods with the
publicscope. No user data.
- Only has access to API methods with the
Refresh Token- Only available via the
Authorization Codegrant type.
- Only available via the
Scopes allow you to restrict what access your OAuth application has access to. When your users authenticate, they will be shown what access you're requesting, so please only request access to the scopes you will actually need.
Endpoint Type | URL
------------------|-----------------------
Token URL | `/api/oauth/token`
Authorization URL | `/api/oauth/authorize`
Data Types¶
DateTimewill be returned as aStringDecimalwhen referring to prices will be returned as aString.Array<ContainerImage>means it returns the same result as the primary REST interface. For example,/api/projects/{project-id}/imageswould return an array of/api/container_images
Available Scopes¶
publicimages_readimages_writedns_readdns_writeorder_readorder_writeprofile_readprofile_writeregisterproject_readproject_write
Pagination¶
All collection requests will be paginated using the headers Per-Page and Total. To set these values in your request, pass the URL params page= and per_page=.
Versioning¶
You may optionally request a specific API version by modifying the Accept header with: application/json; api_version=80, where 80 is the version of the API.
If you omit this value, then the current version will be used.
Current version: 80
If you pass an unsupported API version, you will receive an HTTP status code of 422 (UNPROCESSABLE ENTITY)
Get API Version¶
# GET /version
* `version`: String
* `api_latest_version`: String
* `api_available_versions`: `Array<Integer>`
Successful Responses¶
The following HTTP codes may be returned to denote a successful response:
200 OK201 Created202 Accepted
Error Handling¶
The following error codes may be returned. If any error messages exist, they will be passed to the {errors: []} field.
400 Bad Request401 UnauthorizedBasic auth will return this if your credentials are invalid403 ForbiddenOAuth will return this for invalid tokens404 Not Found408 Request Timeout422 Unprocessable Entity500 Internal Server Error