---
title: "Create an IP restriction entry"
method: POST
path: "/organizations/{organization}/databases/{database}/cidrs"
tags: ["Database Postgres IP restrictions"]
---

# Create an IP restriction entry

`POST /organizations/{organization}/databases/{database}/cidrs`

### Authorization
A service token or OAuth token must have at least one of the following access or scopes in order to use this API endpoint:

**Service Token Accesses**
 `write_database`

**OAuth Scopes**

 | Resource | Scopes |
| :------- | :---------- |
| Organization | `write_databases` |
| Database | `write_database` |

## Path parameters

- `organization` string, required
- `database` string, required

## Request body

- object
  - `schema` string — The PostgreSQL schema to restrict access to. Leave empty or omit to allow access to all schemas.
  - `role` string — The PostgreSQL role to restrict access to. Leave empty or omit to allow access for all roles.
  - `cidrs` string[], required — List of IPv4 CIDR ranges (e.g., ['192.168.1.0/24', '192.168.1.1/32']). Must contain at least one valid IPv4 address or range.
  - `description` string — An optional description for the IP restriction rule.

## Response `201`

Returns the created IP restriction entry

- object
  - `id` string, required — The ID of the IP allowlist entry
  - `schema` string, required — The schema name to restrict access to (optional)
  - `role` string, required — The role to restrict access to (optional)
  - `cidrs` string[], required — List of CIDR ranges
  - `description` string, nullable, required — An optional description for the IP restriction rule
  - `created_at` string, required — When the entry was created
  - `updated_at` string, required — When the entry was updated
  - `deleted_at` string, nullable, required — When the entry was deleted
  - `actor` object, required
    - `id` string, required — The ID of the actor
    - `display_name` string, required — The name of the actor
    - `avatar_url` string, required — The URL of the actor's avatar

## Other responses

- `401` — Unauthorized
- `403` — Forbidden
- `404` — Not Found
- `422` — Unprocessable Entity - Invalid parameters or validation errors
- `500` — Internal Server Error

## Changes

- **2026-08-11** `4b2e4f05bda2` — 2 info
  - added the new optional request property `description`
  - added the required property `description` to the response with the `201` status
- **2026-06-01** `72506953f367` — 1 breaking
  - the response property `deleted_at` became nullable for the status `201`

[Change history](https://skmtc.dev/planetscale/apis/planetscale-api/changes/organizations/:organization/databases/:database/cidrs/post.md)

---

[API](https://skmtc.dev/planetscale/apis/planetscale-api.md) · [All operations](https://skmtc.dev/planetscale/apis/planetscale-api/llms.txt) · [OpenAPI document](https://skmtc-service-production.skmtc.workers.dev/v1/apis/planetscale/planetscale-api/revisions/6d28c038c4fd/schema)
