Issue Machine Access Token
Exchanges machine client credentials for a short-lived access token via OAuth2 client credentials flow.Authentication
This endpoint uses basic authentication with the client credentials in the request body (not the Authorization header).Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
grant_type | string | Required | Must be client_credentials |
client_id | string | Required | Machine client ID (prefix: dyc_) |
client_secret | string | Required | Machine client secret (prefix: dys_) |
scope | string | Optional | Space-delimited scopes (must be subset of client scopes) |
Example Request
Response
Response Fields
| Field | Type | Description |
|---|---|---|
access_token | string | Short-lived bearer token (prefix: dyt_) |
token_type | string | Always Bearer |
expires_in | integer | Token lifetime in seconds (default: 3600) |
scope | string | Granted scopes for this token |
Using the Token
Include the access token in theAuthorization header for machine API calls:
Scope Handling
Requested vs. Granted Scopes: If you request a subset of the client’s scopes, you receive only those:scope parameter, you receive all client scopes:
Token Lifecycle
Default TTL: 3600 seconds (1 hour)Max TTL: Configurable per organization (default 24 hours) Renewal Strategy:
Error Handling
| Status | Condition |
|---|---|
400 | Invalid grant type or scope |
401 | Invalid client credentials |
403 | Client is deactivated (isActive: false) |
Security Considerations
Timing-Safe Comparison: The endpoint usescrypto.timingSafeEqual to prevent timing attacks on credential validation.
Rate Limiting: Token issuance is rate-limited per client (10 requests/minute default).
Audit Logging: Every token issuance is logged with client ID, timestamp, and scopes for security monitoring.
Code Examples
Python:Related Endpoints
- Create Machine Client — Get client credentials
- Machine Artifacts API — Use the token
- Machine Authentication Guide — Complete setup guide