Create a new API key for a service user.
using System.Net.Http.Headers;var client = new HttpClient();var request = new HttpRequestMessage{ Method = HttpMethod.Post, RequestUri = new Uri("https://example.com/api/workspace/users/example/api-keys"), Headers = { { "Authorization", "Bearer <token>" }, }, Content = new StringContent("{ \"Name\": \"example\", \"ExpiresAt\": \"2026-04-15T12:00:00Z\", \"IsPermanent\": true }") { Headers = { ContentType = new MediaTypeHeaderValue("application/json") } }};using (var response = await client.SendAsync(request)){ response.EnsureSuccessStatusCode(); var body = await response.Content.ReadAsStringAsync(); Console.WriteLine(body);}const url = 'https://example.com/api/workspace/users/example/api-keys';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"Name":"example","ExpiresAt":"2026-04-15T12:00:00Z","IsPermanent":true}'};
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://example.com/api/workspace/users/example/api-keys \ --header 'Authorization: Bearer <token>' \ --header 'Content-Type: application/json' \ --data '{ "Name": "example", "ExpiresAt": "2026-04-15T12:00:00Z", "IsPermanent": true }'Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”Query Parameters
Section titled “Query Parameters”Optional access token for clients that cannot set Authorization headers. Prefer Authorization: Bearer <token> when possible.
Request Body
Section titled “Request Body”Request payload to create an API key for a service user.
object
Human-readable label for the key.
Expiration timestamp (required when IsPermanent is false).
When true, the API key never expires.
Examplegenerated
{ "Name": "example", "ExpiresAt": "2026-04-15T12:00:00Z", "IsPermanent": true}Request payload to create an API key for a service user.
object
Human-readable label for the key.
Expiration timestamp (required when IsPermanent is false).
When true, the API key never expires.
Examplegenerated
{ "Name": "example", "ExpiresAt": "2026-04-15T12:00:00Z", "IsPermanent": true}Request payload to create an API key for a service user.
object
Human-readable label for the key.
Expiration timestamp (required when IsPermanent is false).
When true, the API key never expires.
Examplegenerated
{ "Name": "example", "ExpiresAt": "2026-04-15T12:00:00Z", "IsPermanent": true}Responses
Section titled “Responses”OK
object
Response payload for a newly created API key.
object
API key identifier.
Bearer token for the API key.
Label for the key.
Creation timestamp.
Expiration timestamp or null when the key never expires.
object
object
object
object
Example
{ "Errors": [ { "Type": 0, "Severity": 0 } ], "Warnings": [ { "Type": 0, "Severity": 0 } ]}Bad Request
object
Response payload for a newly created API key.
object
API key identifier.
Bearer token for the API key.
Label for the key.
Creation timestamp.
Expiration timestamp or null when the key never expires.
object
object
object
object
Example
{ "Errors": [ { "Type": 0, "Severity": 0 } ], "Warnings": [ { "Type": 0, "Severity": 0 } ]}Forbidden
object
Examplegenerated
{ "type": "example", "title": "example", "status": 1, "detail": "example", "instance": "example"}Not Found
object
Response payload for a newly created API key.
object
API key identifier.
Bearer token for the API key.
Label for the key.
Creation timestamp.
Expiration timestamp or null when the key never expires.
object
object
object
object
Example
{ "Errors": [ { "Type": 0, "Severity": 0 } ], "Warnings": [ { "Type": 0, "Severity": 0 } ]}