Create workspace API credential
const url = 'https://api.dockt.com/v1/api-credentials';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"display_name":"example","description":"example","credential_type":"api_key","allowed_scopes":["account:read"],"expires_at":"2026-08-06T09:30:00Z"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url https://api.dockt.com/v1/api-credentials \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "display_name": "example", "description": "example", "credential_type": "api_key", "allowed_scopes": [ "account:read" ], "expires_at": "2026-08-06T09:30:00Z" }'Creates a machine credential for the active workspace. The returned secret is shown once and cannot be retrieved later.
Authorizations
Section titled “Authorizations ”Parameters
Section titled “ Parameters ”Header Parameters
Section titled “Header Parameters ”Caller-generated retry key for duplicate-sensitive create and resend operations. Keys are scoped to the authenticated principal, method, and route and are retained for 24 hours.
Caller-generated retry key for duplicate-sensitive create and resend operations. Keys are scoped to the authenticated principal, method, and route and are retained for 24 hours.
Request Body required
Section titled “Request Body required ”Creates a machine credential scoped to the active workspace.
object
Human-readable name shown in Dockt and customer systems.
Credential mechanism. Defaults to api_key when omitted.
Permissions granted to the credential. Values must match the target scope type; omitting or sending an empty list applies Dockt’s current least-privilege defaults for that scope.
Optional API-key expiration timestamp. Omit to use the identity provider default. M2M access tokens are short-lived and refreshed through client credentials instead.
Responses
Section titled “ Responses ”Envelope for a single resource response.
Envelope for a single resource response.
object
Newly created credential with one-time secret material included in the response.
object
Unique Dockt API credential identifier.
Human-readable name shown in Dockt and customer systems.
Credential format. API keys are bearer secrets; machine-to-machine credentials use a client credential exchange.
Whether the credential acts across an account or only within one workspace.
A string at least 1 character(s) long
A string at least 1 character(s) long
ISO 8601 date-time string.
ISO 8601 date-time string.
A string at least 1 character(s) long
A string at least 1 character(s) long
Example
{ "object": "single", "data": { "object": "api_credential", "account_id": "acc_example", "workspace_id": "wsp_example", "credential_type": "api_key", "scope_type": "account", "token_url": "https://example.com/webhooks/dockt", "allowed_scopes": [ "account:read" ], "last_used_at": "2026-08-06T09:30:00Z", "created_at": "2026-08-06T09:30:00Z", "updated_at": "2026-08-06T09:30:00Z" }}The request did not match the expected schema
Standard error response with a stable status, human-readable detail, and optional validation errors.
object
Structured request validation issues.
object
One request validation issue with a stable field path and human-readable message.
object
Example
{ "type": "https://docs.dockt.com/errors/invalid-request", "title": "Bad request", "status": 400, "detail": "The request did not match the expected schema.", "instance": "req_example1042"}Problem Details response for HTTP 401. The type URI is the stable machine-readable error code.
Standard error response with a stable status, human-readable detail, and optional validation errors.
object
Structured request validation issues.
object
One request validation issue with a stable field path and human-readable message.
object
Example
{ "type": "https://docs.dockt.com/errors/missing-auth", "title": "Unauthorized", "status": 401, "detail": "Send a valid bearer token or browser session.", "instance": "req_example1042"}Problem Details response for HTTP 403. The type URI is the stable machine-readable error code.
Standard error response with a stable status, human-readable detail, and optional validation errors.
object
Structured request validation issues.
object
One request validation issue with a stable field path and human-readable message.
object
Example
{ "type": "https://docs.dockt.com/errors/forbidden", "title": "Forbidden", "status": 403, "detail": "The authenticated principal does not have the required permission.", "instance": "req_example1042"}Problem Details response for HTTP 404. The type URI is the stable machine-readable error code.
Standard error response with a stable status, human-readable detail, and optional validation errors.
object
Structured request validation issues.
object
One request validation issue with a stable field path and human-readable message.
object
Example
{ "type": "https://docs.dockt.com/errors/not-found", "title": "Not found", "status": 404, "detail": "The requested resource was not found in the authenticated scope.", "instance": "req_example1042"}Problem Details response for HTTP 409. The type URI is the stable machine-readable error code.
Standard error response with a stable status, human-readable detail, and optional validation errors.
object
Structured request validation issues.
object
One request validation issue with a stable field path and human-readable message.
object
Example
{ "type": "https://docs.dockt.com/errors/conflict", "title": "Conflict", "status": 409, "detail": "The request conflicts with the current resource state.", "instance": "req_example1042"}Problem Details response for HTTP 422. The type URI is the stable machine-readable error code.
Standard error response with a stable status, human-readable detail, and optional validation errors.
object
Structured request validation issues.
object
One request validation issue with a stable field path and human-readable message.
object
Example
{ "type": "https://docs.dockt.com/errors/validation", "title": "Validation failed", "status": 422, "detail": "Correct the invalid fields and send the request again.", "instance": "req_example1042", "errors": { "issues": [ { "path": [ "body", "worker", "nationality" ], "message": "Expected a two-letter country code." } ] }}Problem Details response for HTTP 429. The type URI is the stable machine-readable error code.
Standard error response with a stable status, human-readable detail, and optional validation errors.
object
Structured request validation issues.
object
One request validation issue with a stable field path and human-readable message.
object
Example
{ "type": "https://docs.dockt.com/errors/rate-limit", "title": "Too many requests", "status": 429, "detail": "Wait for the Retry-After interval before retrying.", "instance": "req_example1042"}Problem Details response for HTTP 500. The type URI is the stable machine-readable error code.
Standard error response with a stable status, human-readable detail, and optional validation errors.
object
Structured request validation issues.
object
One request validation issue with a stable field path and human-readable message.
object
Example
{ "type": "https://docs.dockt.com/errors/internal", "title": "Internal server error", "status": 500, "detail": "Retry the request safely or contact Dockt support with the request ID.", "instance": "req_example1042"}