Create a new API key (secret or public) for an environment
const url = 'https://api.pingram.io/keys';const options = { method: 'POST', headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'}, body: '{"keyType":"secret","environmentId":"example","name":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}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
Request body for POST /keys endpoint Creates a new API key for an environment
object
Type of key to create - secret for server-to-server, public for client-side
Optional environment ID to scope the key to a specific environment
Human-readable name/description for the key
Responses
200
Successful response
Response body for POST /keys endpoint Returns the newly created API key (only time the full key is returned)
object
Unique identifier for the key (jti)
The full API key string - ONLY returned on creation, never shown again
Type of API key that was created
Environment ID if the key is scoped to a specific environment
Human-readable name/description for the key
ISO 8601 timestamp when the key was created
Example
{ "keyType": "secret"}400
Bad Request - validation errors, invalid input
Standard error response for API errors.
object
Unique tracking ID for the request.
Structured error details for API error responses.
object
Machine-readable error code.
Human-readable error message.
Actionable hint for fixing the error.
Examplegenerated
{ "trackingId": "example", "error": { "code": "example", "message": "example", "fix": "example" }}401
Unauthorized
402
Payment Required - usage limits exceeded
Standard error response for API errors.
object
Unique tracking ID for the request.
Structured error details for API error responses.
object
Machine-readable error code.
Human-readable error message.
Actionable hint for fixing the error.
Examplegenerated
{ "trackingId": "example", "error": { "code": "example", "message": "example", "fix": "example" }}500
Internal Server Error
502
Bad Gateway - provider error
Standard error response for API errors.
object
Unique tracking ID for the request.
Structured error details for API error responses.
object
Machine-readable error code.
Human-readable error message.
Actionable hint for fixing the error.
Examplegenerated
{ "trackingId": "example", "error": { "code": "example", "message": "example", "fix": "example" }}