API Keys
5 API calls in this section.
Create API Key
/api-keysCreates 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
| Parameter | Type | Description |
|---|---|---|
languageOptional | string | Language code for response localization (Optional, default: en) Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
Content-Type | string | Example: |
Body parameters
| Parameter | Type | Description |
|---|---|---|
name | string | — |
expires_at | string | — |
description | string | — |
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
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
/api-keysRetrieves a paginated list of API keys belonging to the authenticated user. This endpoint supports pagination and searching by name.
Query parameters
| Parameter | Type | Description |
|---|---|---|
pageOptional | string | Page number for pagination (Optional, default: 1) Page number for pagination (default: 1) Example: |
limitOptional | string | Number of results per page (Optional, default: 10) Number of results per page (default: 10) Example: |
searchOptional | string | Search term to filter API keys by name (Optional) |
languageOptional | string | Language code for response localization (Optional, default: en) Language code for localized response messages ( Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
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
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
/api-keys/:apiKeyIdUpdates 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 keyexpires_at: New expiration date (must be in the future) or null for no expirationis_active: Whether the API key is activedescription: Updated description or null to remove description
Validations
At least one field must be provided for update
If
expires_atis provided, it must be a valid future dateAPI key must not be revoked
Path parameters
| Parameter | Type | Description |
|---|---|---|
apiKeyIdRequired | string | ID of the API key to update |
Query parameters
| Parameter | Type | Description |
|---|---|---|
languageOptional | string | Language code for response localization (Optional, default: en) Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
Content-Type | string | Example: |
Body parameters
| Parameter | Type | Description |
|---|---|---|
name | string | — |
expires_at | string | — |
is_active | boolean | — |
description | string | — |
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
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
/api-keys/:apiKeyIdRevokes (permanently disables) an API key. This action cannot be undone. Users can only revoke their own API keys.
Path parameters
| Parameter | Type | Description |
|---|---|---|
apiKeyIdRequired | string | ID of the API key to revoke |
Query parameters
| Parameter | Type | Description |
|---|---|---|
languageOptional | string | Language code for response localization (Optional, default: en) Language code for localized response messages ( Example: |
Headers
| Parameter | Type | Description |
|---|---|---|
Authorization | string | Example: |
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
1{2 "success": true,3 "message": "API key revoked successfully"4}Health Check API Key
/api-keys/{{api_key}}/healthVerifies the validity of a tenant-generated API key and retrieves its details, including accessible modules.
No authentication required (API key in path)
Path parameters
| Parameter | Type | Description |
|---|---|---|
api_keyRequired | string | The API key to validate |
1curl --globoff --request GET "https://staging-api.ondi.io/functions/v1/api-keys/${ONDI_TENANT_API_KEY}/health"Response examples
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}