Api Create Api Key Create

Create a new API key for the organization. ``super().post()`` routes through ``OrganizationInjectionMixin.post`` which calls ``inject_target_organization(request)`` — that handles superadmin- gated ``organization`` / ``organization_id`` injection for us. We only need to pin ``user`` (which the injection helper does not touch) before delegating.

Authentication

AuthorizationBearer
JWT access token or Respan API key

Request

This endpoint expects an object.
projectstring or nullOptional>=1 character
namestringOptional1-50 characters

A free-form name for the API key. Need not be unique. 50 characters max.

revokedbooleanOptional

If the API key is revoked, clients cannot use it anymore. (This cannot be undone.)

expiry_datedatetime or nullOptional
Once API key expires, clients cannot use it anymore.
max_usageintegerOptional-2147483648-2147483647
rate_limitdouble or nullOptional
spending_limitdouble or nullOptional
is_testbooleanOptional
is_temporarybooleanOptional

Response

idstringRead-only
api_keystringRead-only
suffixstringRead-only
tagslist of objectsRead-only
statusenum
  • active - Active
  • expired - Expired
  • revoked - Revoked
prefixstringRead-only
hashed_keystringRead-only
createddatetimeRead-only
key_usageintegerRead-only
last_useddatetimeRead-only
spending_in_perioddoubleRead-only
revoked_atdatetime or nullRead-only
revoked_by_emailstring or nullRead-only
userinteger or nullRead-only
organizationinteger or nullRead-only
created_byinteger or nullRead-only
updated_byinteger or nullRead-only
projectstring or null
namestring<=50 characters

A free-form name for the API key. Need not be unique. 50 characters max.

revokedboolean

If the API key is revoked, clients cannot use it anymore. (This cannot be undone.)

expiry_datedatetime or null
Once API key expires, clients cannot use it anymore.
max_usageinteger-2147483648-2147483647
rate_limitdouble or null
spending_limitdouble or null
is_testboolean
is_temporaryboolean