Skip to main content

API Keys

5 API calls in this section.

Create API Key​

Platform & Access / API Keys
POST/api-keys

Creates a new API key for the authenticated user. The API key is returned only once in the response and cannot be retrieved later.

Required Fields

  • name: A descriptive name for the API key

Optional Fields

  • expires_at: ISO 8601 date string when the key should expire (must be in the future)

  • description: Additional information about the key's purpose or usage

Query parameters

ParameterTypeDescription
languageOptionalstring

Language code for response localization (Optional, default: en)

Example: en

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Content-Typestring

Example: application/json

Body parameters

ParameterTypeDescription
namestring—
expires_atstring—
descriptionstring—
Staging
Request
curl
1curl --globoff --request POST "https://staging-api.ondi.io/functions/v1/api-keys?language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3  --header "Content-Type: application/json" \4  --data-raw '{5  "name": "My API Key",6  "expires_at": "2025-12-31T23:59:59Z",7  "description": "API key for integration with my service"8}'

Response examples

201Created
Response body
json
1{2  "success": true,3  "message": "API key created successfully",4  "data": {5    "id": "550e8400-e29b-41d4-a716-446655440000",6    "name": "My API Key",7    "description": "API key for integration with my service",8    "created_at": "2023-01-01T00:00:00Z",9    "expires_at": "2025-12-31T23:59:59Z",10    "is_active": true,11    "api_key": "sr_a1b2c3d4e5f67890abcdef1234567890abcdef1234567890abcdef1234567890"12  }13}

List API Keys​

Platform & Access / API Keys
GET/api-keys

Retrieves a paginated list of API keys belonging to the authenticated user. This endpoint supports pagination and searching by name.

Query parameters

ParameterTypeDescription
pageOptionalstring

Page number for pagination (Optional, default: 1) Page number for pagination (default: 1)

Example: 1

limitOptionalstring

Number of results per page (Optional, default: 10) Number of results per page (default: 10)

Example: 10

searchOptionalstring

Search term to filter API keys by name (Optional)

languageOptionalstring

Language code for response localization (Optional, default: en) Language code for localized response messages (e.g., 'en')

Example: en

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Staging
Request
curl
1curl --globoff --request GET "https://staging-api.ondi.io/functions/v1/api-keys?page=1&limit=10&search=&tenant_id=&user_id=&language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}"

Response examples

200OK
Response body
json
1{2  "success": true,3  "message": "API keys retrieved successfully",4  "apiKeys": [5    {6      "id": "550e8400-e29b-41d4-a716-446655440000",7      "name": "Production API Key",8      "created_at": "2023-01-01T00:00:00Z",9      "created_by": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",10      "expires_at": "2025-12-31T23:59:59Z",11      "is_active": true,12      "revoked_at": null13    },14    {15      "id": "660e8400-e29b-41d4-a716-446655440000",16      "name": "Development API Key",17      "created_at": "2023-01-02T00:00:00Z",18      "created_by": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",19      "expires_at": null,20      "is_active": true,21      "revoked_at": null22    }23  ],24  "total": 2,25  "page": 1,26  "limit": 1027}

Update API Key​

Platform & Access / API Keys
PUT/api-keys/:apiKeyId

Updates an existing API key's properties. Users can only update their own API keys.

Optional Fields (at least one required)

  • name: New name for the API key

  • expires_at: New expiration date (must be in the future) or null for no expiration

  • is_active: Whether the API key is active

  • description: Updated description or null to remove description

Validations

  • At least one field must be provided for update

  • If expires_at is provided, it must be a valid future date

  • API key must not be revoked

Path parameters

ParameterTypeDescription
apiKeyIdRequiredstring

ID of the API key to update

Query parameters

ParameterTypeDescription
languageOptionalstring

Language code for response localization (Optional, default: en)

Example: en

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Content-Typestring

Example: application/json

Body parameters

ParameterTypeDescription
namestring—
expires_atstring—
is_activeboolean—
descriptionstring—
Staging
Request
curl
1curl --globoff --request PUT "https://staging-api.ondi.io/functions/v1/api-keys/${APIKEYID}?language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}" \3  --header "Content-Type: application/json" \4  --data-raw '{5  "name": "Updated API Key Name",6  "expires_at": "2026-12-31T23:59:59Z",7  "is_active": true,8  "description": "Updated description"9}'

Response examples

200OK
Response body
json
1{2  "success": true,3  "message": "API key updated successfully",4  "apiKey": {5    "id": "550e8400-e29b-41d4-a716-446655440000",6    "name": "Updated API Key Name",7    "created_at": "2023-01-01T00:00:00Z",8    "expires_at": "2026-12-31T23:59:59Z",9    "is_active": true,10    "description": "Updated description"11  }12}

Revoke API Key​

Platform & Access / API Keys
DELETE/api-keys/:apiKeyId

Revokes (permanently disables) an API key. This action cannot be undone. Users can only revoke their own API keys.

Path parameters

ParameterTypeDescription
apiKeyIdRequiredstring

ID of the API key to revoke

Query parameters

ParameterTypeDescription
languageOptionalstring

Language code for response localization (Optional, default: en) Language code for localized response messages (e.g., 'en')

Example: en

Headers

ParameterTypeDescription
Authorizationstring

Example: Bearer {{access_token}}

Staging
Request
curl
1curl --globoff --request DELETE "https://staging-api.ondi.io/functions/v1/api-keys/${APIKEYID}?language=en" \2  --header "Authorization: Bearer ${ONDI_ACCESS_TOKEN}"

Response examples

200OK
Response body
json
1{2  "success": true,3  "message": "API key revoked successfully"4}

Health Check API Key​

Platform & Access / API Keys
GET/api-keys/{{api_key}}/health

Verifies the validity of a tenant-generated API key and retrieves its details, including accessible modules.

  • No authentication required (API key in path)

Path parameters

ParameterTypeDescription
api_keyRequiredstring

The API key to validate

Staging
Request
curl
1curl --globoff --request GET "https://staging-api.ondi.io/functions/v1/api-keys/${ONDI_TENANT_API_KEY}/health"

Response examples

200OK
Response body
json
1{2  "message": "API key is valid",3  "id": "550e8400-e29b-41d4-a716-446655440000",4  "name": "Production API Key",5  "created_at": "2023-01-01T00:00:00Z",6  "created_by": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",7  "expires_at": "2025-12-31T23:59:59Z",8  "is_active": true,9  "revoked_at": null,10  "modules": [11    "delivery",12    "warehousing"13  ]14}