> 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/p0-management/management-api/just-in-time-settings-api.md).

# Just-in-time settings API

The JIT Access Settings API allows organizations to define how long temporary access should last—and under what conditions. Admins can configure approvable, standing, and maximum access durations, create custom expiry presets, and enforce approval policies like requiring justifications or second-party approval. This makes it easy to align access privileges with least-privilege principles and audit requirements, without slowing teams down.

## POST /expiry-options

> Add a custom expiry duration

```json
{"openapi":"3.0.4","info":{"title":"P0 JIT Management API","version":"1.0.0"},"servers":[{"url":"https://api.p0.app/o/{orgId}/settings","variables":{"orgId":{"default":"demo-org","description":"The organization ID"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key"}},"schemas":{"DurationOptionRequest":{"type":"object","required":["time","unit"],"properties":{"time":{"type":"number"},"unit":{"type":"string","enum":["m","h","d","w"]}}}},"responses":{"BadRequestError":{"description":"Bad request"},"UnauthorizedError":{"description":"Unauthorized"}}},"paths":{"/expiry-options":{"post":{"summary":"Add a custom expiry duration","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DurationOptionRequest"}}}},"responses":{"204":{"description":"Custom expiry added"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/UnauthorizedError"}}}}}}
```

## DELETE /expiry-options/{key}

> Remove a custom expiry duration

```json
{"openapi":"3.0.4","info":{"title":"P0 JIT Management API","version":"1.0.0"},"servers":[{"url":"https://api.p0.app/o/{orgId}/settings","variables":{"orgId":{"default":"demo-org","description":"The organization ID"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key"}},"responses":{"BadRequestError":{"description":"Bad request"},"UnauthorizedError":{"description":"Unauthorized"}}},"paths":{"/expiry-options/{key}":{"delete":{"summary":"Remove a custom expiry duration","parameters":[{"name":"key","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"204":{"description":"Custom expiry removed"},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/UnauthorizedError"}}}}}}
```

## POST /expiry-options/\_reset

> Reset custom expiry durations

```json
{"openapi":"3.0.4","info":{"title":"P0 JIT Management API","version":"1.0.0"},"servers":[{"url":"https://api.p0.app/o/{orgId}/settings","variables":{"orgId":{"default":"demo-org","description":"The organization ID"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key"}},"schemas":{"DurationSettings":{"type":"object","required":["options"],"properties":{"options":{"type":"array","items":{"$ref":"#/components/schemas/DurationOptionResponse"}},"maxAccessDuration":{"$ref":"#/components/schemas/DurationOptionResponse"},"standingAccessDuration":{"$ref":"#/components/schemas/DurationOptionResponse"}}},"DurationOptionResponse":{"type":"object","required":["time","unit","value"],"properties":{"value":{"type":"string"},"time":{"type":"number"},"unit":{"type":"string","enum":["m","h","d","w"]}}}},"responses":{"BadRequestError":{"description":"Bad request"},"UnauthorizedError":{"description":"Unauthorized"}}},"paths":{"/expiry-options/_reset":{"post":{"summary":"Reset custom expiry durations","responses":{"200":{"description":"Reset expiry options","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DurationSettings"}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/UnauthorizedError"}}}}}}
```

## PUT /standing-access-duration

> Set custom standing access duration

```json
{"openapi":"3.0.4","info":{"title":"P0 JIT Management API","version":"1.0.0"},"servers":[{"url":"https://api.p0.app/o/{orgId}/settings","variables":{"orgId":{"default":"demo-org","description":"The organization ID"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key"}},"schemas":{"DurationOptionRequest":{"type":"object","required":["time","unit"],"properties":{"time":{"type":"number"},"unit":{"type":"string","enum":["m","h","d","w"]}}},"DurationOptionResponse":{"type":"object","required":["time","unit","value"],"properties":{"value":{"type":"string"},"time":{"type":"number"},"unit":{"type":"string","enum":["m","h","d","w"]}}}},"responses":{"BadRequestError":{"description":"Bad request"},"UnauthorizedError":{"description":"Unauthorized"}}},"paths":{"/standing-access-duration":{"put":{"summary":"Set custom standing access duration","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DurationOptionRequest"}}}},"responses":{"200":{"description":"Standing access configured","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"standingAccessDuration":{"$ref":"#/components/schemas/DurationOptionResponse"}}}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/UnauthorizedError"}}}}}}
```

## PUT /max-access-duration

> Set custom maximum access duration

```json
{"openapi":"3.0.4","info":{"title":"P0 JIT Management API","version":"1.0.0"},"servers":[{"url":"https://api.p0.app/o/{orgId}/settings","variables":{"orgId":{"default":"demo-org","description":"The organization ID"}}}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"API Key"}},"schemas":{"DurationOptionRequest":{"type":"object","required":["time","unit"],"properties":{"time":{"type":"number"},"unit":{"type":"string","enum":["m","h","d","w"]}}},"DurationOptionResponse":{"type":"object","required":["time","unit","value"],"properties":{"value":{"type":"string"},"time":{"type":"number"},"unit":{"type":"string","enum":["m","h","d","w"]}}}},"responses":{"BadRequestError":{"description":"Bad request"},"UnauthorizedError":{"description":"Unauthorized"}}},"paths":{"/max-access-duration":{"put":{"summary":"Set custom maximum access duration","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DurationOptionRequest"}}}},"responses":{"200":{"description":"Max access configured","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"maxAccessDuration":{"$ref":"#/components/schemas/DurationOptionResponse"}}}}}},"400":{"$ref":"#/components/responses/BadRequestError"},"401":{"$ref":"#/components/responses/UnauthorizedError"}}}}}}
```

## The DurationOptionRequest object

```json
{"openapi":"3.0.4","info":{"title":"P0 JIT Management API","version":"1.0.0"},"components":{"schemas":{"DurationOptionRequest":{"type":"object","required":["time","unit"],"properties":{"time":{"type":"number"},"unit":{"type":"string","enum":["m","h","d","w"]}}}}}}
```

## The DurationOptionResponse object

```json
{"openapi":"3.0.4","info":{"title":"P0 JIT Management API","version":"1.0.0"},"components":{"schemas":{"DurationOptionResponse":{"type":"object","required":["time","unit","value"],"properties":{"value":{"type":"string"},"time":{"type":"number"},"unit":{"type":"string","enum":["m","h","d","w"]}}}}}}
```

## The DurationSettings object

```json
{"openapi":"3.0.4","info":{"title":"P0 JIT Management API","version":"1.0.0"},"components":{"schemas":{"DurationSettings":{"type":"object","required":["options"],"properties":{"options":{"type":"array","items":{"$ref":"#/components/schemas/DurationOptionResponse"}},"maxAccessDuration":{"$ref":"#/components/schemas/DurationOptionResponse"},"standingAccessDuration":{"$ref":"#/components/schemas/DurationOptionResponse"}}},"DurationOptionResponse":{"type":"object","required":["time","unit","value"],"properties":{"value":{"type":"string"},"time":{"type":"number"},"unit":{"type":"string","enum":["m","h","d","w"]}}}}}}
```


---

# 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/p0-management/management-api/just-in-time-settings-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.
