> For the complete documentation index, see [llms.txt](https://docs.p0.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.p0.dev/access-management/just-in-time-access/just-in-time-api/access-requests-api.md).

# Access requests API

The Access Request API enables programmatic approval, denial, and revocation of access requests within the P0 platform. It is designed to support custom workflows and automation. Integrate with external systems and services to process access grants without using the P0 user interface.

This is particularly useful for integrating P0 into your internal tooling, bots, or security workflows that require automatic access escalation based on alerts, CI/CD pipelines, or external approvals.

## Approve a permission request

> Approve an access request by request ID.

```json
{"openapi":"3.0.4","info":{"title":"P0 Permission Request API","version":"1.0.0"},"servers":[{"url":"https://api.p0.app"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}}},"paths":{"/o/{orgId}/permission-requests/{requestId}/approve":{"post":{"summary":"Approve a permission request","operationId":"approveRequest","description":"Approve an access request by request ID.","parameters":[{"name":"orgId","in":"path","description":"Organization identifier","required":true,"schema":{"type":"string"}},{"name":"requestId","in":"path","description":"Unique identifier for the permission request","required":true,"schema":{"type":"string"}}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["expirationLength"],"properties":{"expirationLength":{"type":"string","description":"Duration for which access should be granted (e.g. \"2h\", \"30m\")"}}}}}},"responses":{"200":{"description":"Request approved"},"400":{"description":"Invalid or expired request"},"401":{"description":"Unauthorized"}}}}}}
```

## Deny a permission request

> Deny an access request by request ID.

```json
{"openapi":"3.0.4","info":{"title":"P0 Permission Request API","version":"1.0.0"},"servers":[{"url":"https://api.p0.app"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}}},"paths":{"/o/{orgId}/permission-requests/{requestId}/deny":{"post":{"summary":"Deny a permission request","operationId":"denyRequest","description":"Deny an access request by request ID.","parameters":[{"name":"orgId","in":"path","description":"Organization identifier","required":true,"schema":{"type":"string"}},{"name":"requestId","in":"path","description":"Unique identifier for the permission request","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"Request denied"},"400":{"description":"Invalid or expired request"},"401":{"description":"Unauthorized"}}}}}}
```

## Revoke a granted permission

> Revoke access previously granted by request ID.

```json
{"openapi":"3.0.4","info":{"title":"P0 Permission Request API","version":"1.0.0"},"servers":[{"url":"https://api.p0.app"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"}}},"paths":{"/o/{orgId}/permission-requests/{requestId}/revoke":{"post":{"summary":"Revoke a granted permission","operationId":"revokeRequest","description":"Revoke access previously granted by request ID.","parameters":[{"name":"orgId","in":"path","description":"Organization identifier","required":true,"schema":{"type":"string"}},{"name":"requestId","in":"path","description":"Unique identifier for the permission request","required":true,"schema":{"type":"string"}}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"Access revoked"},"400":{"description":"Invalid or expired request"},"401":{"description":"Unauthorized"}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.p0.dev/access-management/just-in-time-access/just-in-time-api/access-requests-api.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
