curl --request POST \
--url https://paradigm.lighton.ai/api/v3/keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://paradigm.lighton.ai/api/v3/keys"
payload = {
"name": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', expires_at: '2023-11-07T05:31:56Z'})
};
fetch('https://paradigm.lighton.ai/api/v3/keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "<string>",
"name": "<string>",
"prefix": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"scopes": [
{
"workspace_id": 123,
"workspace_name": "<string>",
"workspace_upload_method": "<string>",
"workspace_datasource_type": "<string>",
"role": "<string>",
"scope_type": "workspace"
}
],
"key": "<string>"
}{
"id": null,
"code": 400,
"error": "bad_request",
"detail": "You have reached the maximum allowed number of api keys. Think about deleting some to create new ones.",
"doc_url": "https://developers.lighton.ai/errors#bad_request"
}{
"id": null,
"code": 401,
"error": "unauthorized",
"detail": "Authentication credentials were not provided or are invalid.",
"doc_url": "https://developers.lighton.ai/errors#unauthorized"
}{
"id": null,
"code": 422,
"error": "validation_error",
"detail": "One or more fields failed validation.",
"doc_url": "https://developers.lighton.ai/errors#validation_error",
"fields": {
"<field_name>": [
{
"error": "required",
"detail": "This field is required."
}
]
}
}{
"detail": "System is under maintenance.",
"error": "service_maintenance",
"mode": "full_shutdown",
"reason": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"endpoint_category_names": [
"<string>"
]
}Create API key
Create a new API key for the authenticated user.
The full key value is returned only once in the creation response and cannot be retrieved again afterwards.
expires_at is required:
- A future datetime expires the key at that time.
nullcreates a key that never expires.
Workspace scoping (optional): include scopes — a list of {workspace_id, permission} entries — to restrict the key to those workspaces. Each entry’s permission is one of viewer, editor, or owner, and cannot exceed the role you currently hold on that workspace. Different scopes on the same key can carry different permissions.
curl --request POST \
--url https://paradigm.lighton.ai/api/v3/keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"name": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
'import requests
url = "https://paradigm.lighton.ai/api/v3/keys"
payload = {
"name": "<string>",
"expires_at": "2023-11-07T05:31:56Z"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({name: '<string>', expires_at: '2023-11-07T05:31:56Z'})
};
fetch('https://paradigm.lighton.ai/api/v3/keys', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));{
"id": "<string>",
"name": "<string>",
"prefix": "<string>",
"created_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"scopes": [
{
"workspace_id": 123,
"workspace_name": "<string>",
"workspace_upload_method": "<string>",
"workspace_datasource_type": "<string>",
"role": "<string>",
"scope_type": "workspace"
}
],
"key": "<string>"
}{
"id": null,
"code": 400,
"error": "bad_request",
"detail": "You have reached the maximum allowed number of api keys. Think about deleting some to create new ones.",
"doc_url": "https://developers.lighton.ai/errors#bad_request"
}{
"id": null,
"code": 401,
"error": "unauthorized",
"detail": "Authentication credentials were not provided or are invalid.",
"doc_url": "https://developers.lighton.ai/errors#unauthorized"
}{
"id": null,
"code": 422,
"error": "validation_error",
"detail": "One or more fields failed validation.",
"doc_url": "https://developers.lighton.ai/errors#validation_error",
"fields": {
"<field_name>": [
{
"error": "required",
"detail": "This field is required."
}
]
}
}{
"detail": "System is under maintenance.",
"error": "service_maintenance",
"mode": "full_shutdown",
"reason": "<string>",
"started_at": "2023-11-07T05:31:56Z",
"endpoint_category_names": [
"<string>"
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Body
Reject any request fields not declared on the serializer.
250Expiration datetime for the API key. Set to a future datetime to expire the key at that time, or null to create a key that never expires.
Optional list of {workspace_id, role} entries. Providing this field marks the key as workspace-scoped: it can only access the listed workspaces, with the per-workspace role shown. The requested role on each workspace is capped at the role you currently hold there.
Show child attributes
Show child attributes
Response
API key created. The key field contains the full key value — save it now, it will not be shown again.