Skip to main content
POST
/
organizations
/
{organization}
/
databases
/
{database_name}
/
cidrs
Create an IP restriction entry
curl --request POST \
  --url https://api.planetscale.com/v1/organizations/{organization}/databases/{database_name}/cidrs \
  --header 'Authorization: <api-key>' \
  --header 'Content-Type: application/json' \
  --data '{
  "schema": "<string>",
  "role": "<string>",
  "cidrs": [
    "<string>"
  ]
}'
{
  "id": "<string>",
  "schema": "<string>",
  "role": "<string>",
  "cidrs": [
    "<string>"
  ],
  "created_at": "<string>",
  "updated_at": "<string>",
  "deleted_at": "<string>",
  "actor": {
    "id": "<string>",
    "display_name": "<string>",
    "avatar_url": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Path Parameters

organization
string
required

The name of the organization the database belongs to

database_name
string
required

The name of the database

Body

application/json
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.

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.

Response

Returns the created IP restriction entry

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

created_at
string
required

When the entry was created

updated_at
string
required

When the entry was updated

deleted_at
string
required

When the entry was deleted

actor
object
required