Permit.io API Keys API
The API Keys API from Permit.io, for api keys.
The API Keys API from Permit.io, for api keys.
Every API here is available over the APIs.io API and to AI agents over MCP.
One button, every client — Claude, Cursor, VS Code and the rest.
https://apis.io/mcp
find_apisBrowse and filter every API in the catalog.get_api_artifactsOne API's artifacts, grouped by type.get_openapiThe primary OpenAPI for this API.find_similar_apisAPIs that look like this one.apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.resolveTurn a domain, URL or GitHub org into the provider it belongs to.find_cohortsEvery scored population of providers in the catalog.curl "https://apis.io/api/v1/apis/permitio:permitio-api-keys-api"
curl "https://apis.io/api/v1/apis?limit=25"
Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.
Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.
A second provider on the same verified email joins the account you already have.
openapi: 3.2.0
info:
title: Permit.io API Keys API
description: Authorization as a service
version: 2.0.0
tags:
- name: API Keys
paths:
/v2/api-key/{proj_id}/{env_id}:
get:
tags:
- API Keys
summary: Get Environment Api Key
operationId: get_environment_api_key
security:
- HTTPBearer: []
parameters:
- name: proj_id
in: path
required: true
schema:
type: string
description: 'Either the unique id of the project, or the URL-friendly key of the project (i.e: the "slug").'
title: Proj Id
description: 'Either the unique id of the project, or the URL-friendly key of the project (i.e: the "slug").'
example: my_project
- name: env_id
in: path
required: true
schema:
type: string
description: 'Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the "slug").'
title: Env Id
description: 'Either the unique id of the environment, or the URL-friendly key of the environment (i.e: the "slug").'
example: my_environment
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/APIKeyRead'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/v2/api-key/scope:
get:
tags:
- API Keys
summary: Get Api Key Scope
operationId: get_api_key_scope
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/APIKeyScopeRead'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
security:
- HTTPBearer: []
/v2/api-key:
get:
tags:
- API Keys
summary: List Api Keys
description: Lists all the api_keys under the active organization.
operationId: list_api_keys
security:
- HTTPBearer: []
parameters:
- name: object_type
in: query
required: false
schema:
anyOf:
- $ref: '#/components/schemas/MemberAccessObj'
- type: 'null'
title: Object Type
- name: proj_id
in: query
required: false
schema:
anyOf:
- type: string
- type: 'null'
description: Optional project filter by project id or key
title: Proj Id
description: Optional project filter by project id or key
- name: page
in: query
required: false
schema:
type: integer
minimum: 1
description: Page number of the results to fetch, starting at 1.
default: 1
title: Page
description: Page number of the results to fetch, starting at 1.
- name: per_page
in: query
required: false
schema:
type: integer
maximum: 100
minimum: 1
description: The number of results per page (max 100).
default: 30
title: Per Page
description: The number of results per page (max 100).
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/PaginatedResult_APIKeyRead_'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
post:
tags:
- API Keys
summary: Create Api Key
description: Creates a new api_key under the active organization.
operationId: create_api_key
security:
- HTTPBearer: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/APIKeyCreate'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/APIKeyRead'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/v2/api-key/{api_key_id}:
get:
tags:
- API Keys
summary: Get Api Key
description: Gets a single api_key matching the given api_key_id, if such api_key exists.
operationId: get_api_key
security:
- HTTPBearer: []
parameters:
- name: api_key_id
in: path
required: true
schema:
type: string
description: The unique id of the API key
title: Api Key Id
description: The unique id of the API key
example: 42f0e113-219b-4bb9-ba90-e2c904761ce1
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/APIKeyRead'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
delete:
tags:
- API Keys
summary: Delete Api Key
description: Deletes the api_key and all its related data.
operationId: delete_api_key
security:
- HTTPBearer: []
parameters:
- name: api_key_id
in: path
required: true
schema:
type: string
description: The unique id of the API key
title: Api Key Id
description: The unique id of the API key
example: 42f0e113-219b-4bb9-ba90-e2c904761ce1
responses:
'204':
description: Successful Response
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/v2/api-key/{api_key_id}/rotate-secret:
post:
tags:
- API Keys
summary: Rotate API Key
description: 'Rotates the API key of the PDP container with id `pdp_id`.
The rotation of the API key revokes the old API key and issues a new API key to the PDP.'
operationId: rotate_api_key
security:
- HTTPBearer: []
parameters:
- name: api_key_id
in: path
required: true
schema:
type: string
format: uuid
description: The unique id of the API key
title: Api Key Id
description: The unique id of the API key
example: 42f0e113-219b-4bb9-ba90-e2c904761ce1
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/APIKeyRead'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
components:
schemas:
APIKeyRead:
properties:
organization_id:
type: string
format: uuid
title: Organization Id
project_id:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Project Id
environment_id:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Environment Id
object_type:
$ref: '#/components/schemas/MemberAccessObj'
default: env
access_level:
$ref: '#/components/schemas/MemberAccessLevel'
default: admin
owner_type:
$ref: '#/components/schemas/APIKeyOwnerType'
name:
anyOf:
- type: string
- type: 'null'
title: Name
id:
type: string
format: uuid
title: Id
secret:
anyOf:
- type: string
- type: 'null'
title: Secret
created_at:
type: string
format: date-time
title: Created At
created_by_member:
anyOf:
- $ref: '#/components/schemas/OrgMemberRead'
- type: 'null'
last_used_at:
anyOf:
- type: string
format: date-time
- type: 'null'
title: Last Used At
env:
anyOf:
- $ref: '#/components/schemas/EnvironmentRead'
- type: 'null'
project:
anyOf:
- $ref: '#/components/schemas/ProjectRead'
- type: 'null'
additionalProperties: false
type: object
required:
- organization_id
- owner_type
- id
- created_at
title: APIKeyRead
APIKeyOwnerType:
type: string
enum:
- pdp_config
- member
- elements
- nats_pdp_config
title: APIKeyOwnerType
ProjectRead:
properties:
key:
type: string
title: Key
description: 'A URL-friendly name of the project (i.e: slug). You will be able to query later using this key instead of the id (UUID) of the project.'
urn_namespace:
anyOf:
- type: string
pattern: ^[a-z0-9-]{2,}
- type: 'null'
title: Urn Namespace
description: Optional namespace for URNs. If empty, URNs will be generated from project key.
id:
type: string
format: uuid
title: Id
description: Unique id of the project
organization_id:
type: string
format: uuid
title: Organization Id
description: Unique id of the organization that the project belongs to.
created_at:
type: string
format: date-time
title: Created At
description: Date and time when the project was created (ISO_8601 format).
updated_at:
type: string
format: date-time
title: Updated At
description: Date and time when the project was last updated/modified (ISO_8601 format).
name:
type: string
title: Name
description: The name of the project
description:
anyOf:
- type: string
- type: 'null'
title: Description
description: a longer description outlining the project objectives
settings:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
title: Settings
description: the settings for this project
active_policy_repo_id:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Active Policy Repo Id
description: the id of the policy repo to use for this project
additionalProperties: false
type: object
required:
- key
- id
- organization_id
- created_at
- updated_at
- name
title: ProjectRead
OnboardingStep:
type: string
enum:
- create_organization
- create_project
- create_resource
- create_actions
- assign_permissions
- assign_user_roles
- connect_sdk
- done
title: OnboardingStep
EnvironmentRead:
properties:
key:
type: string
title: Key
description: 'A URL-friendly name of the environment (i.e: slug). You will be able to query later using this key instead of the id (UUID) of the environment.'
id:
type: string
format: uuid
title: Id
description: Unique id of the environment
organization_id:
type: string
format: uuid
title: Organization Id
description: Unique id of the organization that the environment belongs to.
project_id:
type: string
format: uuid
title: Project Id
description: Unique id of the project that the environment belongs to.
created_at:
type: string
format: date-time
title: Created At
description: Date and time when the environment was created (ISO_8601 format).
updated_at:
type: string
format: date-time
title: Updated At
description: Date and time when the environment was last updated/modified (ISO_8601 format).
avp_policy_store_id:
anyOf:
- type: string
- type: 'null'
title: Avp Policy Store Id
hidden_from_schema: true
name:
type: string
title: Name
description: The name of the environment
description:
anyOf:
- type: string
- type: 'null'
title: Description
description: an optional longer description of the environment
custom_branch_name:
anyOf:
- type: string
- type: 'null'
title: Custom Branch Name
description: when using gitops feature, an optional branch name for the environment
jwks:
anyOf:
- $ref: '#/components/schemas/JwksConfig'
- type: 'null'
description: jwks for element frontend only login
settings:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
title: Settings
description: the settings for this environment
jwks_unpinned:
items:
type: string
type: array
title: Jwks Unpinned
description: 'Read-only. Which of `jwks.issuer` and `jwks.audience` this environment leaves unset: Elements login takes each of those from the token itself, so it checks nothing, and any application whose tokens the same JWKS signs can log in. On a JWKS that must pin both (Firebase Auth''s always; a shared IdP host, such as Entra ID or Google, once the deployment refuses unpinned shared configs) Elements login and invite approval are refused instead. Empty when both are set or no JWKS is configured.'
additionalProperties: false
type: object
required:
- key
- id
- organization_id
- project_id
- created_at
- updated_at
- name
title: EnvironmentRead
InviteRead:
properties:
member_id:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Member Id
description: Unique id of the invite
email:
type: string
format: email
title: Email
description: The invited member's email address
role:
$ref: '#/components/schemas/MemberAccessLevel'
description: The role the member will be assigned with
default: admin
id:
type: string
format: uuid
title: Id
description: Unique id of the invite
organization_id:
type: string
format: uuid
title: Organization Id
description: Unique id of the organization that the invite belongs to.
invite_code:
type: string
format: uuid
title: Invite Code
description: The invite code that is sent to the member's email
created_at:
type: string
format: date-time
title: Created At
description: Date and time when the invite was created (ISO_8601 format).
status:
$ref: '#/components/schemas/InviteStatus'
description: The status of the invite (pending, failed, etc)
failed_reason:
anyOf:
- type: string
- type: 'null'
title: Failed Reason
description: if failed, the reason the invitation failed
additionalProperties: false
type: object
required:
- email
- id
- organization_id
- invite_code
- created_at
- status
title: InviteRead
example:
created_at: '2019-08-24T14:15:22Z'
email: jane@coolcompany.com
failed_reason: ''
id: 497f6eca-6276-4993-bfeb-53cbbbba6f08
invite_code: 40ef0e48-a11f-4963-a229-e396c9eeefff
organization_id: 7c60d51f-b44e-4682-87d6-449835ea4de6
role: admin
status: pending
PaginatedResult_APIKeyRead_:
properties:
data:
items:
$ref: '#/components/schemas/APIKeyRead'
type: array
title: Data
description: List of Api Keys
total_count:
type: integer
minimum: 0.0
title: Total Count
description: The number of results across all pages.
page_count:
type: integer
minimum: 0.0
title: Page Count
description: 'The number of pages at the requested `per_page`: `ceil(total_count / per_page)`. Fetch pages 1 to `page_count` to read every result. It is 0 when there are no results, and on a page past the last one.'
default: 0
additionalProperties: false
type: object
required:
- data
- total_count
title: PaginatedResult[APIKeyRead]
APIKeyCreate:
properties:
organization_id:
type: string
format: uuid
title: Organization Id
project_id:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Project Id
environment_id:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Environment Id
object_type:
$ref: '#/components/schemas/MemberAccessObj'
default: env
access_level:
$ref: '#/components/schemas/MemberAccessLevel'
default: admin
owner_type:
$ref: '#/components/schemas/APIKeyOwnerType'
default: member
name:
anyOf:
- type: string
- type: 'null'
title: Name
additionalProperties: false
type: object
required:
- organization_id
title: APIKeyCreate
APIKeyScopeRead:
properties:
organization_id:
type: string
format: uuid
title: Organization Id
description: Unique id of the organization that the api_key belongs to.
project_id:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Project Id
description: Unique id of the project that the api_key belongs to.
environment_id:
anyOf:
- type: string
format: uuid
- type: 'null'
title: Environment Id
description: Unique id of the environment that the api_key belongs to.
additionalProperties: false
type: object
required:
- organization_id
title: APIKeyScopeRead
JwksObj:
properties:
keys:
items:
additionalProperties: true
type: object
type: array
title: Keys
description: 'The keys to match against the request headers: public keys only. A key carrying a private member (`d`, `p`, `q`, `dp`, `dq`, `qi`, `oth`, `k`), or a symmetric `oct` key, is refused on write, except that an update may send back a key exactly as stored. Reads show each key without those members and leave `oct` keys out.'
additionalProperties: false
type: object
required:
- keys
title: JwksObj
ValidationError:
properties:
loc:
items:
anyOf:
- type: string
- type: integer
type: array
title: Location
msg:
type: string
title: Message
type:
type: string
title: Error Type
input:
title: Input
ctx:
type: object
title: Context
type: object
required:
- loc
- msg
- type
title: ValidationError
MemberAccessObj:
type: string
enum:
- org
- project
- env
title: MemberAccessObj
MemberAccessLevel:
type: string
enum:
- admin
- write
- read
- no_access
title: MemberAccessLevel
InviteStatus:
type: string
enum:
- pending
- accepted
- failed
- canceled
title: InviteStatus
OrgMemberRead:
properties:
id:
type: string
format: uuid
title: Id
description: Unique id of the account member
email:
type: string
format: email
title: Email
description: Email of the user controlling this account
email_verified:
type: boolean
title: Email Verified
description: Whether this email address is verified or not. For social providers like 'Login with Google' this is done automatically, otherwise we will send the user a verification link in email.
name:
anyOf:
- type: string
- type: 'null'
title: Name
description: Name of this user
given_name:
anyOf:
- type: string
- type: 'null'
title: Given Name
description: First name of the user
family_name:
anyOf:
- type: string
- type: 'null'
title: Family Name
description: Last name of the user
picture:
anyOf:
- type: string
- type: 'null'
title: Picture
description: URL to picture, photo, or avatar of the user that controls this account.
is_superuser:
type: boolean
title: Is Superuser
description: Whether or not this user has special access to permit.io organizations
is_onboarding:
type: boolean
title: Is Onboarding
description: Whether or not this user is currently onboarding, needs to be replaced by a user journey object
onboarding_step:
$ref: '#/components/schemas/OnboardingStep'
description: the step the user is currently going through in onboarding
created_at:
type: string
format: date-time
title: Created At
description: Date and time when the account member was created (ISO_8601 format).
last_login:
anyOf:
- type: string
format: date-time
- type: 'null'
title: Last Login
description: Last date and time this user logged in (ISO_8601 format).
last_ip:
type: string
title: Last Ip
description: Last IP address from which this user logged in.
default: 0.0.0.0
logins_count:
type: integer
title: Logins Count
description: Total number of logins this user has performed.
default: 0
identities:
items:
$ref: '#/components/schemas/IdentityRead'
type: array
title: Identities
invite:
anyOf:
- $ref: '#/components/schemas/InviteRead'
- type: 'null'
settings:
additionalProperties: true
type: object
title: Settings
description: Custom permit.io dashboard settings, such as preferred theme, etc.
additionalProperties: false
type: object
required:
- id
- email
- email_verified
- is_superuser
- is_onboarding
- onboarding_step
- created_at
- identities
- settings
title: OrgMemberRead
example:
created_at: '2019-08-20T14:15:22Z'
email: janedoe@permituser.com
email_verified: true
family_name: Doe
given_name: Jane
id: 497f6eca-6276-4993-bfeb-53cbbbba6f08
identities:
- email: Jane@permituser.com
email_verified: true
provider: google-oauth2
sub: '000000000000000000001'
user_id: google-oauth2|000000000000000000001
user_info:
address:
country: us
birthdate: '1972-03-31'
email: janedoe@permituser.com
email_verified: true
family_name: Doe
gender: female
given_name: Jane
locale: en-US
middle_name: Josephine
name: Jane Josephine Doe
nickname: JJ
phone_number: +1 (111) 222-3434
phone_number_verified: false
picture: http://permituser.com/janedoe/me.jpg
preferred_username: j.doe
profile: http://permituser.com/janedoe
sub: '000000000000000000001'
updated_at: '1556845729'
website: http://permituser.com
zoneinfo: America/Los_Angeles
invite:
created_at: '2019-08-24T14:15:22Z'
email: Jane@permituser.com
failed_reason: ''
id: 497f6eca-6276-4993-bfeb-53cbbbba6f08
invite_code: 40ef0e48-a11f-4963-a229-e396c9eeefff
organization_id: 7c60d51f-b44e-4682-87d6-449835ea4de6
role: admin
status: pending
is_onboarding: true
is_superuser: false
last_ip: 1.2.3.4
last_login: '2019-08-24T14:15:22Z'
logins_count: 2
name: Jane Josephine Doe
onboarding_step: done
picture: http://permituser.com/janedoe/me.jpg
settings:
another-option: another-value
option: value
IdentityRead:
properties:
user_id:
type: string
title: User Id
description: Unique User Id of this identity in the identity provider (including the provider type)
provider:
type: string
title: Provider
description: The identity provider type this identity came from
sub:
type: string
title: Sub
description: Unique User Id of this identity in the identity provider (NOT including the provider type)
email:
type: string
format: email
title: Email
description: Email connected to this account identity
email_verified:
type: boolean
title: Email Verified
description: Whether this email address connected to this account identity is verified or not. For social providers like 'Login with Google' this is done automatically, otherwise we will send the user a verification link in email.
auth0_info:
anyOf:
- additionalProperties: true
type: object
- type: 'null'
title: Auth0 Info
description: Raw user info json coming from our identity provider and matching a specific account identity
additionalProperties: false
type: object
required:
- user_id
- provider
- sub
- email
- email_verified
- auth0_info
title: IdentityRead
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
JwksConfig:
properties:
ttl:
anyOf:
- type: integer
- type: 'null'
title: Ttl
description: JWKS cache TTL (in seconds)
default: 600
url:
anyOf:
- type: string
pattern: ^https://[a-zA-Z0-9\-\.]+\.[a-zA-Z]{2,3}(/\S*)?$
- type: 'null'
title: Url
description: '...'
jwks:
anyOf:
- $ref: '#/components/schemas/JwksObj'
- type: 'null'
description: '...'
issuer:
anyOf:
- type: string
- items:
type: string
type: array
- type: 'null'
title: Issuer
description: 'The ''iss'' claim an Elements user JWT must carry, compared exactly (an Auth0 issuer ends in ''/''); with a list, a token from any one of them is accepted. When set, a token from any other issuer is rejected. Set it, together with `audience`, whenever the JWKS''s keys also sign tokens for other applications: Entra ID (any `login.microsoftonline.com` JWKS URL, tenant-specific ones included, because Entra''s signing keys are shared by every tenant), Google, Apple, or an Auth0 or Cognito tenant other applications use. For a `url` on one of those shared hosts (Entra, Google, Apple, Salesforce, LinkedIn, Facebook) both are required when the config is created or its `url` is set or changed, and by an update that leaves `user_key_claim` set and changes it, this or `audience`. On Firebase Auth''s JWKS (any URL whose last path segment is `securetoken@system.gserviceaccount.com` or `sessionCookiePublicKeys`, in any case) both are required on those writes, and Elements login and invite approval are refused until both are set: `issuer` ''https://securetoken.google.com/<project-id>'' (session cookies: ''https://session.firebase.google.com/<project-id>'') and `audience` ''<project-id>''. A value left unset is taken from the token itself, so it checks nothing. An update whose `jwks` omits it keeps the stored value; send null to clear it.'
audience:
anyOf:
- type: string
- items:
type: string
type: array
- type: 'null'
title: Audience
description: 'The audience an Elements user JWT''s ''aud'' claim must contain; with a list, a token naming at least one of them is accepted. When set, a token minted for any other audience is rejected. Setting it alone does not check the issuer: on Entra ID set `issuer` too, or a token another tenant issued for this audience is accepted. Cognito access tokens carry no ''aud'' (they carry `client_id`), so only Cognito ID tokens pass when it is set. Required on the same shared-host and Firebase Auth configs as `issuer` (see its description). An update whose `jwks` omits it keeps the stored value; send null to clear it.'
user_key_claim:
anyOf:
- type: string
- type: 'null'
title: User Key Claim
description: 'The claim of an Elements user JWT whose value is the Permit user key; unset means ''sub''. Elements login and invite approval read the user key from this claim only: a request''s own `user_key_claim` is accepted only when omitted, ''sub'', or equal to this one, and is otherwise rejected. The claim''s value must be a non-empty string or an integer (read as its decimal string; a boolean, or a number with a fraction or exponent, is rejected); ''email'' is accepted only from a token whose ''email_verified'' is the JSON boolean true (that check applies only to a claim named exactly ''email''; tokens without ''email_verified'', such as Entra ID''s, or with the string ''true'', as Sign in with Apple has sent, cannot use it, and an email-keyed user changes key when the IdP email changes). Name only a claim your IdP sets: claims the end user or the client can set (an OIDC ''nonce'', ''name'', ''aud'', ...) are refused, and a custom claim filled from metadata the user can edit is just as unsafe. An update whose `jwks` omits it keeps the stored value; send null to clear it. On a shared IdP host (Entra ID, Google, ...), an update that leaves it set and changes it, `issuer` or `audience` needs both of those set, so neither can be cleared while it is set. Removing the whole config (`jwks: null`) removes it too, so a config created again keys users on ''sub'' until it is set again.'
additionalProperties: false
type: object
title: JwksConfig
securitySchemes:
HTTPBearer:
type: http
description: 'Authorization header, we support the bearer authentication scheme (see: RFC 6750)'
scheme: bearer
bearerFormat: JWT