Skip to main content
Version: V2

Create API key

POST 

/v2/organizations/:orgId/api-keys

Create a new API key for an organization. Pick a scope (admin, manager, or generator) and the domains it can hit (artworks, style-dna, textcraft, or *). The full key is returned once in the response, so store it somewhere safe before closing the connection.

Request

Path Parameters

    orgId stringrequired

    Organization ID

    Example: 507f1f77bcf86cd799439011

Body

required

    label stringrequired

    Possible values: non-empty and <= 100 characters

    Human-readable label for the API key

    scope stringrequired

    Possible values: [admin, manager, generator]

    Scope determines the permissions of the API key (admin, manager, or generator)

    domains string[]required

    Possible values: [artworks, style-dna, textcraft, *], >= 1

    Feature domains the key may access. Admin scope auto-overrides to ['*'].

    credits integer

    Default value: 0

    Initial credits allocated to the API key

Responses

API key created successfully. The apiKey field contains the full key and will only be shown once.

Schema

    keyId stringrequired

    Unique identifier for the API key

    apiKey string

    The full API key - ONLY shown once at creation. Store this securely.

    keyPrefix stringrequired

    First 10 characters of the API key for identification

    label stringrequired

    Human-readable label for the API key

    scope stringrequired

    Possible values: [admin, manager, generator]

    Permission scope of the API key

    domains string[]required

    Possible values: [artworks, style-dna, textcraft, *]

    Feature domains the key may access

    environment stringrequired

    Possible values: [live, test]

    Environment the key is valid for

    credits numberrequired

    Available credits for this API key

    status stringrequired

    Possible values: [active, revoked, expired]

    Current status of the API key

    usageCount numberrequired

    Number of times the key has been used

    lastUsedAt date-timenullablerequired

    Last time the key was used (ISO 8601 format)

    expiresAt date-timenullablerequired

    Expiration date of the key (ISO 8601 format)

    createdAt date-timerequired

    Creation date of the key (ISO 8601 format)

Loading...