Skip to content

Create a new API key (secret or public) for an environment

POST
/keys
curl --request POST \
--url https://api.pingram.io/keys \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{ "keyType": "secret", "environmentId": "example", "name": "example" }'

Authorizations

Request Bodyrequired

Media typeapplication/json

Request body for POST /keys endpoint Creates a new API key for an environment

object
keyType
required

Type of key to create - secret for server-to-server, public for client-side

string
Allowed values: secret public
environmentId

Optional environment ID to scope the key to a specific environment

string
name
required

Human-readable name/description for the key

string

Responses

200

Successful response

Media typeapplication/json

Response body for POST /keys endpoint Returns the newly created API key (only time the full key is returned)

object
id
required

Unique identifier for the key (jti)

string
key
required

The full API key string - ONLY returned on creation, never shown again

string
keyType
required

Type of API key that was created

string
Allowed values: secret public
environmentId

Environment ID if the key is scoped to a specific environment

string
name
required

Human-readable name/description for the key

string
createdAt
required

ISO 8601 timestamp when the key was created

string
Example
{
"keyType": "secret"
}

400

Bad Request - validation errors, invalid input

Media typeapplication/json

Standard error response for API errors.

object
trackingId
required

Unique tracking ID for the request.

string
error
required

Structured error details for API error responses.

object
code
required

Machine-readable error code.

string
message
required

Human-readable error message.

string
fix

Actionable hint for fixing the error.

string
Examplegenerated
{
"trackingId": "example",
"error": {
"code": "example",
"message": "example",
"fix": "example"
}
}

401

Unauthorized

402

Payment Required - usage limits exceeded

Media typeapplication/json

Standard error response for API errors.

object
trackingId
required

Unique tracking ID for the request.

string
error
required

Structured error details for API error responses.

object
code
required

Machine-readable error code.

string
message
required

Human-readable error message.

string
fix

Actionable hint for fixing the error.

string
Examplegenerated
{
"trackingId": "example",
"error": {
"code": "example",
"message": "example",
"fix": "example"
}
}

500

Internal Server Error

502

Bad Gateway - provider error

Media typeapplication/json

Standard error response for API errors.

object
trackingId
required

Unique tracking ID for the request.

string
error
required

Structured error details for API error responses.

object
code
required

Machine-readable error code.

string
message
required

Human-readable error message.

string
fix

Actionable hint for fixing the error.

string
Examplegenerated
{
"trackingId": "example",
"error": {
"code": "example",
"message": "example",
"fix": "example"
}
}