POST /apikeys
Create a new apiKey
Create a new apikey for the current user's account. Only account administrators can create API keys.
Authentication Required
Authorization: Bearer {token}
header string This header is required to access this endpoint
Required Parameters
x-account-id
header string Account ID for the request
Request Body
{ "description": "string", "flatPermissionsList": [ "string" ]}{ "description": "string", "expiresAt": "string", "flatPermissionsList": [ "string" ]}Try it out
Loading...
Output:
Responses
Description
ApiKey created successfully
{ "id": 0, "description": "string", "expiresAt": "string", "permissions": [ {} ], "apiKey": "string", "lastFourOfSecret": "string", "createdAt": "string", "updatedAt": "string", "apiSecret": "string"}Description
Bad Request - Invalid input parameters
Description
Unauthorized - User not authenticated
Description
Forbidden - User does not have the required permissions
Description
Internal server error
References
#/components/parameters/xAccountIdHeader#/components/schemas/ApiKeyInput#/components/schemas/ApiKey#/components/schemas/ApiKeyWithSecret
#/components/parameters/xAccountIdHeader
in: headername: x-account-idschema: type: stringdescription: Account ID for the requestrequired: trueexample: "2311"|export type xAccountIdHeader = any; // Schema type not fully supported#/components/schemas/ApiKeyInput
type: objectrequired: - description - flatPermissionsListproperties: description: type: string description: Description of the API key expiresAt: type: string format: date-time nullable: true description: ISO date-time string when the API key expires, or null/empty for no expiration flatPermissionsList: type: array example: - readApplications - writeApplications items: type: string description: List of permission IDs to assign to the API key>export interface ApiKeyInput { /** Description of the API key */ description: string; /** ISO date-time string when the API key expires, or null/empty for no expiration */ expiresAt?: Date; /** List of permission IDs to assign to the API key */ flatPermissionsList: string[];}#/components/schemas/ApiKey
type: objectrequired: - description - apiKeyproperties: id: type: integer readOnly: true description: type: string description: Description of the API key expiresAt: type: string format: date-time nullable: true description: ISO date-time string when the API key expires, or null/empty for no expiration permissions: type: array items: type: object apiKey: type: string lastFourOfSecret: type: string createdAt: type: string format: date-time readOnly: true updatedAt: type: string format: date-time readOnly: true>export interface ApiKey { id?: number; /** Description of the API key */ description: string; /** ISO date-time string when the API key expires, or null/empty for no expiration */ expiresAt?: Date; permissions?: {}[]; apiKey: string; lastFourOfSecret?: string; createdAt?: Date; updatedAt?: Date;}#/components/schemas/ApiKeyWithSecret
allOf: - type: object required: - description - apiKey properties: id: type: integer readOnly: true description: type: string description: Description of the API key expiresAt: type: string format: date-time nullable: true description: ISO date-time string when the API key expires, or null/empty for no expiration permissions: type: array items: type: object apiKey: type: string lastFourOfSecret: type: string createdAt: type: string format: date-time readOnly: true updatedAt: type: string format: date-time readOnly: true fromRef: "#/components/schemas/ApiKey" - properties: apiSecret: type: string description: The secret used to authenticate with the API key. This value is only returned when initially creating the API key and cannot be retrieved again. required: - apiSecret>export interface ApiKeyWithSecret_AllOf_0 { id?: number; /** Description of the API key */ description: string; /** ISO date-time string when the API key expires, or null/empty for no expiration */ expiresAt?: Date; permissions?: {}[]; apiKey: string; lastFourOfSecret?: string; createdAt?: Date; updatedAt?: Date;}
export interface ApiKeyWithSecret_AllOf_1 { /** The secret used to authenticate with the API key. This value is only returned when initially creating the API key and cannot be retrieved again. */ apiSecret: string;}
export type ApiKeyWithSecret = ApiKeyWithSecret_AllOf_0 & ApiKeyWithSecret_AllOf_1;Route Source Code
Check out the source code for this route entrypoint here: /apikeys/route.ts
Or the swagger.yaml spec this documentation was generated from:
/apikeys/swagger.yaml