Permit.io Policy Git Repositories API
The Policy Git Repositories API from Permit.io, for policy git repositories.
The Policy Git Repositories API from Permit.io, for policy git repositories.
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-policy-git-repositories-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 Policy Git Repositories API
description: Authorization as a service
version: 2.0.0
tags:
- name: Policy Git Repositories
paths:
/v2/projects/{proj_id}/repos:
get:
tags:
- Policy Git Repositories
summary: List Policy Repos
description: Lists all the policy repositories under a given project.
operationId: list_policy_repos
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: 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:
type: array
items:
$ref: '#/components/schemas/PolicyRepoRead'
title: Response List Policy Repos V2 Projects Proj Id Repos Get
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
post:
tags:
- Policy Git Repositories
summary: Create Policy Repo
description: 'Creates a new policy repository configuration under a given project.
The given repository is created with status ''pending'', it will be changed and used as the ''active'' repository for
the policy only after a successful attempt to use it.
The repository main branch must be present in the remote.'
operationId: create_policy_repo
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
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PolicyRepoCreate'
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/PolicyRepoRead'
'403':
description: 'Nothing is written. The caller may not make the change, or it would change the policy source of a project holding an environment that a policy guard protects: then it is refused for every caller allowed to make it, with error code `POLICY_GUARD_PROTECTED`, until an organization admin removes the project from the policy guard scope (an organization with no scope clears the flag by creating one and deleting it). Every change of the active policy repository on such a project needs that: a switch back to Permit''s policy, and a new deploy key, which takes a new repository and its activation, included'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/v2/projects/{proj_id}/repos/active:
get:
tags:
- Policy Git Repositories
summary: Get Active Policy Repo
description: Gets the currently active repository, if such repository exists.
operationId: get_active_policy_repo
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
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/PolicyRepoRead'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/v2/projects/{proj_id}/repos/disable:
put:
tags:
- Policy Git Repositories
summary: Disable Active Policy Repo
description: 'Disable the currently active policy repo, this action means to turn off the gitops feature.
If there is no active policy repo, this action will do nothing.'
operationId: disable_active_policy_repo
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
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/ProjectRead'
'403':
description: 'Nothing is written. The caller may not make the change, or it would change the policy source of a project holding an environment that a policy guard protects: then it is refused for every caller allowed to make it, with error code `POLICY_GUARD_PROTECTED`, until an organization admin removes the project from the policy guard scope (an organization with no scope clears the flag by creating one and deleting it). Every change of the active policy repository on such a project needs that: a switch back to Permit''s policy, and a new deploy key, which takes a new repository and its activation, included'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/v2/projects/{proj_id}/repos/{repo_id}/activate:
put:
tags:
- Policy Git Repositories
summary: Activate Policy Repo
description: 'Makes the given policy repo the project''s active one, the source of the policy its
environments'' PDPs run. The repo must be valid.'
operationId: activate_policy_repo
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: repo_id
in: path
required: true
schema:
type: string
description: 'Either the unique id of the policy repo, or the URL-friendly key of the policy repo (i.e: the "slug").'
title: Repo Id
description: 'Either the unique id of the policy repo, or the URL-friendly key of the policy repo (i.e: the "slug").'
example: my_policy_repo
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/ProjectRead'
'400':
description: Invalid policy repo status
'403':
description: 'Nothing is written. The caller may not make the change, or it would change the policy source of a project holding an environment that a policy guard protects: then it is refused for every caller allowed to make it, with error code `POLICY_GUARD_PROTECTED`, until an organization admin removes the project from the policy guard scope (an organization with no scope clears the flag by creating one and deleting it). Every change of the active policy repository on such a project needs that: a switch back to Permit''s policy, and a new deploy key, which takes a new repository and its activation, included'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
/v2/projects/{proj_id}/repos/{repo_id}:
get:
tags:
- Policy Git Repositories
summary: Get Policy Repo
description: Gets a single repository matching the given repo_id, if such repository exists.
operationId: get_policy_repo
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: repo_id
in: path
required: true
schema:
type: string
description: 'Either the unique id of the policy repo, or the URL-friendly key of the policy repo (i.e: the "slug").'
title: Repo Id
description: 'Either the unique id of the policy repo, or the URL-friendly key of the policy repo (i.e: the "slug").'
example: my_policy_repo
responses:
'200':
description: Successful Response
content:
application/json:
schema:
$ref: '#/components/schemas/PolicyRepoRead'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
delete:
tags:
- Policy Git Repositories
summary: Delete Policy Repo
description: 'Deletes a policy repository. Its project, when this is its active repository, goes back to
Permit''s policy.'
operationId: delete_policy_repo
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: repo_id
in: path
required: true
schema:
type: string
description: 'Either the unique id of the policy repo, or the URL-friendly key of the policy repo (i.e: the "slug").'
title: Repo Id
description: 'Either the unique id of the policy repo, or the URL-friendly key of the policy repo (i.e: the "slug").'
example: my_policy_repo
responses:
'204':
description: Successful Response
'403':
description: 'Nothing is written. The caller may not make the change, or it would change the policy source of a project holding an environment that a policy guard protects: then it is refused for every caller allowed to make it, with error code `POLICY_GUARD_PROTECTED`, until an organization admin removes the project from the policy guard scope (an organization with no scope clears the flag by creating one and deleting it). Every change of the active policy repository on such a project needs that: a switch back to Permit''s policy, and a new deploy key, which takes a new repository and its activation, included'
'422':
description: Validation Error
content:
application/json:
schema:
$ref: '#/components/schemas/HTTPValidationError'
components:
schemas:
PolicyRepoRead:
properties:
id:
type: string
format: uuid
title: Id
description: Unique id of the policy repo
status:
$ref: '#/components/schemas/PolicyRepoStatus'
key:
type: string
pattern: ^[A-Za-z0-9\-_]+$
title: Key
description: 'A URL-friendly name of the policy repo (i.e: slug). You will be able to query later using this key instead of the id (UUID) of the policy repo.'
url:
type: string
title: Url
description: The SSH URL of the git repository (e.g. git@github.com:username/repository.git)
main_branch_name:
type: string
title: Main Branch Name
default: main
credentials:
$ref: '#/components/schemas/SSHAuthDataRead'
activate_when_validated:
type: boolean
title: Activate When Validated
description: if you want to change your policy repository to this repo right after it is validated
default: false
additionalProperties: false
type: object
required:
- id
- status
- key
- url
- credentials
title: PolicyRepoRead
SSHAuthDataRead:
properties:
auth_type:
type: string
title: Auth Type
default: ssh
enum:
- ssh
username:
type: string
title: Username
description: SSH username
public_key:
anyOf:
- type: string
- type: 'null'
title: Public Key
description: SSH public key
private_key:
type: string
title: Private Key
description: SSH private key
type: object
required:
- username
- private_key
title: SSHAuthDataRead
SSHAuthData:
properties:
auth_type:
type: string
title: Auth Type
default: ssh
enum:
- ssh
username:
type: string
title: Username
description: SSH username
public_key:
anyOf:
- type: string
- type: 'null'
title: Public Key
description: SSH public key
private_key:
type: string
title: Private Key
description: SSH private key
type: object
required:
- username
- private_key
title: SSHAuthData
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
HTTPValidationError:
properties:
detail:
items:
$ref: '#/components/schemas/ValidationError'
type: array
title: Detail
type: object
title: HTTPValidationError
PolicyRepoStatus:
type: string
enum:
- invalid
- pending
- valid
title: PolicyRepoStatus
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
PolicyRepoCreate:
properties:
key:
type: string
pattern: ^[A-Za-z0-9\-_]+$
title: Key
description: 'A URL-friendly name of the policy repo (i.e: slug). You will be able to query later using this key instead of the id (UUID) of the policy repo.'
url:
type: string
title: Url
description: The SSH URL of the git repository (e.g. git@github.com:username/repository.git)
main_branch_name:
type: string
title: Main Branch Name
default: main
credentials:
$ref: '#/components/schemas/SSHAuthData'
activate_when_validated:
type: boolean
title: Activate When Validated
description: if you want to change your policy repository to this repo right after it is validated
default: false
additionalProperties: false
type: object
required:
- key
- url
- credentials
title: PolicyRepoCreate
securitySchemes:
HTTPBearer:
type: http
description: 'Authorization header, we support the bearer authentication scheme (see: RFC 6750)'
scheme: bearer
bearerFormat: JWT