Skip to content

POST /v1/keys

Availability
Private Preview
Method and path
POST /v1/keys
API version
1.0.0-private-preview
Base URL
https://api.torq.finance
Authentication
SecretKey
Idempotency
Required header: Idempotency-Key.
Rate limits
Read x-ratelimit-* and x-request-id response headers. Do not hard-code a quota.

Authentication requirements

  • SecretKey

Request examples

terminal
curl -X POST 'https://api.torq.finance/v1/keys' \
  -H 'Accept: application/json' \
  -H 'Authorization: Bearer $TORQ_SECRET_KEY' \
  -H 'Idempotency-Key: $TORQ_IDEMPOTENCY_KEY' \
  -H 'Content-Type: application/json' \
  --data '{"kind":"publishable","scopes":["sample_scopes"]}'
Run a safe sample

This calls the docs preview and returns sample data shaped by the governed OpenAPI response. It never accepts credentials or changes protocol state.

Run the sample call to inspect a schema-shaped response without credentials or side effects.
Request body
ApiKeyCreateRequest

Parameters

Idempotency-Key
header
Yes
string

Request schema

ApiKeyCreateRequest ApiKeyCreateRequest

kind
enum
Yes
—
scopes
string[]
Yes
—
origins
string (uri)[]
No
—
Inspect nested properties

kind enum · required

one of: publishable, secret

scopes string[] · required

items string

origins string (uri)[] · optional

items string (uri)

Responses

200
Successful response
ApiKeyCreated
400
Invalid request
TorqApiError
401
Authentication required
TorqApiError
403
Insufficient scope or authority
TorqApiError
409
State or idempotency conflict
TorqApiError
429
Rate limit exceeded
TorqApiError
500
Internal failure
TorqApiError

200 response schema

ApiKeyCreated ApiKeyCreated

id
string
Yes
—
applicationId
string
Yes
—
kind
enum
Yes
—
token
string
Yes
—
scopes
string[]
Yes
—
origins
string[]
No
—
rotatedFromKeyId
string | null
No
—
secretShownOnce
boolean
Yes
—
createdAt
string (date-time)
No
—
Inspect nested properties

id string · required

minimum length: 1 · maximum length: 200

applicationId string · required

minimum length: 1 · maximum length: 200

kind enum · required

one of: publishable, secret

token string · required

minimum length: 1 · maximum length: 200

scopes string[] · required

items string

origins string[] · optional

items string

rotatedFromKeyId string | null · optional

nullable

secretShownOnce boolean · required

createdAt string (date-time) · optional

400, 401, 403, 409, 429, 500 response schema

TorqApiError TorqApiError

ok
boolean
Yes
—
code
string
Yes
—
message
string
Yes
—
requestId
string
Yes
—
retryable
boolean
Yes
—
blockedReason
string | null
No
—
docsUrl
string (uri)
No
—
Inspect nested properties

ok boolean · required

code string · required

minimum length: 1 · maximum length: 200

message string · required

minimum length: 1 · maximum length: 200

requestId string · required

minimum length: 1 · maximum length: 200

retryable boolean · required

blockedReason string | null · optional

nullable

docsUrl string (uri) · optional

Related guides

For retry behavior and blocked-state handling, see Errors and rate limits.