Api keys
4 operations under api-keys. Examples read $API and $KEY from your shell.
GET /v1/api-keys
Parameters
limitinteger optional in querystarting_afterstring optional in query
Responses
200 Default Response
object
dataarray requiredEach item:
idstring requirednamestring requiredprefixstring requiredscopesarray of string requiredallowed_ipsarray of string requiredcreated_atstring requiredrevoked_atstring required (nullable)
has_moreboolean required
Errors are RFC 9457 problem documents (application/problem+json).
curl
curl -s \
"$API/v1/api-keys" \
-H "authorization: Bearer $KEY"SDK
import { createScrClient } from "@scr/sdk";
// The client sends the API key for you.
const client = createScrClient({ baseUrl: process.env.API!, apiKey: process.env.KEY! });
const { data, error } = await client.GET("/v1/api-keys");POST /v1/api-keys
Send an Idempotency-Key header on every POST so a retry never repeats the request.
Request body
application/json, required
object
namestring requiredscopesarray of string requiredallowed_ipsarray of string optional
Responses
201 Default Response
object
idstring requirednamestring requiredprefixstring requiredscopesarray of string requiredallowed_ipsarray of string requiredcreated_atstring requiredrevoked_atstring required (nullable)secretstring required
Errors are RFC 9457 problem documents (application/problem+json).
curl
curl -s \
-X POST \
"$API/v1/api-keys" \
-H "authorization: Bearer $KEY" \
-H "idempotency-key: $(uuidgen)" \
-H "content-type: application/json" \
-d '{"name":"<name>","scopes":[]}'SDK
import { createScrClient } from "@scr/sdk";
// The client sends the API key and an Idempotency-Key for you.
const client = createScrClient({ baseUrl: process.env.API!, apiKey: process.env.KEY! });
const { data, error } = await client.POST("/v1/api-keys", {
body: {
"name": "<name>",
"scopes": []
},
});PATCH /v1/api-keys/{id}
Parameters
idstring required in path
Request body
application/json, required
object
allowed_ipsarray of string required
Responses
200 Default Response
object
idstring requirednamestring requiredprefixstring requiredscopesarray of string requiredallowed_ipsarray of string requiredcreated_atstring requiredrevoked_atstring required (nullable)
Errors are RFC 9457 problem documents (application/problem+json).
curl
curl -s \
-X PATCH \
"$API/v1/api-keys/$ID" \
-H "authorization: Bearer $KEY" \
-H "content-type: application/json" \
-d '{"allowed_ips":[]}'SDK
import { createScrClient } from "@scr/sdk";
// The client sends the API key for you.
const client = createScrClient({ baseUrl: process.env.API!, apiKey: process.env.KEY! });
const { data, error } = await client.PATCH("/v1/api-keys/{id}", {
params: { path: { id: "<id>" } },
body: {
"allowed_ips": []
},
});POST /v1/api-keys/{id}/revoke
Send an Idempotency-Key header on every POST so a retry never repeats the request.
Parameters
idstring required in path
Responses
200 Default Response
object
idstring requirednamestring requiredprefixstring requiredscopesarray of string requiredallowed_ipsarray of string requiredcreated_atstring requiredrevoked_atstring required (nullable)
Errors are RFC 9457 problem documents (application/problem+json).
curl
curl -s \
-X POST \
"$API/v1/api-keys/$ID/revoke" \
-H "authorization: Bearer $KEY" \
-H "idempotency-key: $(uuidgen)"SDK
import { createScrClient } from "@scr/sdk";
// The client sends the API key and an Idempotency-Key for you.
const client = createScrClient({ baseUrl: process.env.API!, apiKey: process.env.KEY! });
const { data, error } = await client.POST("/v1/api-keys/{id}/revoke", {
params: { path: { id: "<id>" } },
});