Create a new API key. The full key is returned only once, in this response — store it securely. Syntext keeps only a one-way hash of it.
Note
Requires the admin or owner role. A member of the workspace gets 403 forbidden ("Only workspace admins can create API keys.") with details.requiredRole and details.currentRole. Any member can list keys.
Path Parameters
NameDescription
projectId:stringpathRequired
The project ID.
Request Body
NameDescription
name:stringbodyRequired
A descriptive name (1–100 chars), e.g. "CI deploy key".
scope:stringbody
One of full, build, or read.
Default"full"
expiresInDays:integerbody
Optional expiry, 1–365 days. Omit for a non-expiring key.
Response — 201 Created
Warning
The key field is only returned at creation (and on rotation). If you lose it, rotate the key — it cannot be retrieved.
Key Format
Keys look like stx_{8-char prefix}_{secret}. The prefix is safe to display and log; the full key is a secret.
last4 holds the last four characters of the full key, so you can show a masked key such as stx_a1b2c3d4_…Once without storing the secret. It is stored when the key is created or rotated.