Skip to the page

Reference · Control API

Projects

Create projects and set up each project’s endpoint, keys, sign-in, webhooks, file imports and query insights.

In the schema
—

Projects#

Project control routes bind a project to a dedicated cluster and configure its HTTPS endpoint, service keys, access reach audits, sign-in providers, change webhooks, S3 imports and query insights.

Per-project HTTPS endpoint and policies

Control CORS origins, passthrough query lockdown, injected caller globals, sign-in providers and outbound webhook allowlists.

Branch-isolated settings and credentials

Every non-main branch maintains independent endpoint settings, ndb_… service keys, webhooks and value-blind access reach checks.

RouteDescriptionScope
GET /projects#List all projects in the organization with cluster assignment and API statusScoperead
POST /projectsCreate a new project by name and return the project’s initial verification operationScopemanage

POST/projects#

Request body

namestringrequired
Unique project name within the organization (1–128 characters, not only spaces).

Napalm places the project on a ready cluster in your organization that has no project yet. When no unassigned ready cluster exists, the route answers 409 conflict, so provision a cluster first with POST /clusters. Sending an existing project’s name again returns that project’s newest verification operation without creating a duplicate. Poll GET /operations/{id} until verification completes and the project’s state reaches ready.

Create a project · curl
curl https://api.napalmdata.com/projects \  -H "Authorization: Bearer $NAPALM_TOKEN" \  -H "Content-Type: application/json" \  -d {    "name": "notes"  }
Response (202 Accepted)
{  "operation": {    "id": "0192c3f4-6b1a-7d8e-9f00-1a2b3c4d5e6f",    "operationType": "projectVerification",    "status": "pending",    "projectId": "8a4d2c10-5e3b-4f9a-8c12-6d7e8f9a0b1c",    "clusterId": "7a1e9c2b-4d3f-4b8a-9e6c-2f1d0b8a7c35",    "orgId": "3c8f1a2e-9b4d-4e7c-a1f6-5d2b8e0c9a47",    "insertTime": "2026-11-10T14:20:00Z"  }}

API settings#

RouteDescriptionScope
GET /projects/{id}/endpoint#Read the project API URL and current API settings (pass ?branch= to inspect a branch)Scoperead
POST /projects/{id}/endpoint#Enable or disable the project API and update CORS origins, globals, passthrough or limitsScopemanage

POST /projects/{id}/endpoint

isActivebooleanrequired
Enables or disables the project API. Every branch has ext::napalm from creation.
isReadOnlybooleanrequired
When true, rejects all mutations across every session and service key.
allowedOriginsstring[]required
Up to 32 exact origins permitted to make browser requests via CORS. Each origin uses HTTPS, or HTTP on localhost or 127.0.0.1 for a dev server.
userGlobalsobjectrequired
Default global variable values injected into user session requests, keyed by qualified name.
serviceGlobalsobjectrequired
Default global variable values injected into service key requests.
isSchemaSharedboolean
Allows callers and MCP/A2A agents to inspect the SDL schema and call POST /ask. Defaults to false.
passthroughstring
Controls who may execute arbitrary ad-hoc EdgeQL statements: "none", "keys" or "all" (default).
cliNamestring
Custom binary name for the auto-generated project CLI (defaults to the project label).
agentConsentUrlstring
Custom HTTPS URL for the OAuth 2.1 agent consent screen.
hiddenFromClistring[]
Deployed query names omitted from the generated project CLI.
hiddenFromAgentsstring[]
Deployed query names omitted from MCP and A2A tool discovery.
grantGlobalsstring[]
Up to 32 globals a person may set on an agent’s grant at consent, by module::name. A person chooses each value, so read such a global in a deny rule alone.
branchstring
Target branch name when configuring a non-main branch endpoint.

Service keys#

RouteDescriptionScope
GET /projects/{id}/keys#List service key metadata (id, label, branch, read-only flag and expiration)Scoperead
POST /projects/{id}/keysIssue a new service key (returns the plaintext ndb_… token once)Scopemanage
POST /projects/{id}/keys/{key}/revoke#Revoke a service keyScopemanage
GET /projects/{id}/insights/keys#Read per-key activity on a branch: calls, writes, failed calls, first use and last useScoperead
GET /projects/{id}/keys/{key}/usage#Read one key’s history by hour and day, with failures, addresses and queriesScoperead
POST /projects/{id}/insights/keys#Set how many days a branch keeps a key’s hourly and daily countsScopemanage

POST/projects/{id}/keys#

Request body

labelstringrequired
Human-readable description of the key’s purpose (1–128 characters).
isReadOnlybooleanrequired
Restricts the key to read-only queries and blocks all mutations, even on a writable project.
daysintegerrequired
Validity period in days before automatic expiration (1–365).
branchstring
Binds the key to one database branch (main when omitted). Every other branch refuses the key.
globalsobject
Per-key global values keyed by module::name (string, number or boolean, up to 32 entries). These values overlay the branch’s serviceGlobals so access policies can tell service keys apart.

The response returns { "id": "…", "token": "ndb_…" } and shows the plaintext token once. Napalm stores only a SHA-256 hash of the token. You can issue keys before turning on the project API, audit a key’s row reach with GET /projects/{id}/keys/{key}/reach and revoke a key with POST /projects/{id}/keys/{key}/revoke. Subsequent Project API calls with a revoked or expired key answer 401 invalid_key.

Revoking a key returns { "revoked": true, "isDelivered": true } once every engine has dropped it. "isDelivered": false means an engine did not acknowledge within 8 seconds, though the key is already revoked and Napalm keeps retrying delivery until every engine drops it. You do not need to call revoke again.

Each branch holds up to 500 live service keys (revoked and expired keys do not count). Issuing a key past that limit returns 409 key_limit_reached with the limit in message.

GET /projects/{id}/insights/keys returns one entry for each key and source. The sources are http, mcp and a2a for calls to the project’s address, job for a job the key queued, schedule for a scheduled job that runs as the key, and webhook for rows read to build a webhook delivery. calls, writeCalls and failedCalls cover the last 30 days, or the number of days in days. firstTime, lastTime, totalCalls and lastRefusedTime are kept for as long as the branch exists. Refused calls count against a key only when that key belongs to the branch. Calls with unrecognized keys accumulate under unknownKeyCalls, so guessed tokens never create per-key entries.

GET /projects/{id}/keys/{key}/usage returns one key’s history: calls by hour and by day, failed calls by error code and deployed query, source addresses, and the deployed queries the key called. Napalm keeps the newest 100 addresses per key, and a revoked key’s history stays readable.

A branch keeps hourly counts for 30 days and daily counts for 365 days. The hourly counts cover a key’s calls, deployed query latency and root usage. POST /projects/{id}/insights/keys with hourDays and dayDays changes both, from 1 to 3,650 days each. Napalm removes older counts as new calls arrive and never removes a key’s first use, last use or total. Requesting a window longer than the branch’s retention returns the retained days.

Issue a service key · curl
curl https://api.napalmdata.com/projects/$PROJECT/keys \  -H "Authorization: Bearer $NAPALM_TOKEN" \  -H "Content-Type: application/json" \  -d {    "label": "billing-worker",    "isReadOnly": false,    "days": 90,    "globals": { "default::role": "worker" }  }
Response
{  "id": "0b6f1f5e-2a4c-4d7e-9f3b-8c1d2e3f4a5b",  "token": "ndb_r8Km3xP9qW2vL7nB4cF1dH6jS0tY5uA8eG3iM2oR9pU"}

Access and reach audits#

Audit how your schema’s access policies behave for service keys and individual user identities before or after granting access. See Access and sign-in for details on how reach counts and policy explanations are computed.

RouteDescriptionScope
GET /projects/{id}/keys/{key}/reach#Count readable, updatable and deletable objects per type for an existing keyScoperead
GET /projects/{id}/keys/reach#Preview reach counts for a prospective key (?isReadOnly=true&branch=pr-12)Scoperead
POST /projects/{id}/explain-access#Evaluate every access policy on a specific object ID for a key, a user identity or a prospective key (isReadOnly, branch and globals in the body)Scopemanage
GET /projects/{id}/people#Search registered user identities on a branch by email substring, ID or subject (up to 50)Scopemanage
GET /projects/{id}/people/{identity}/reach#Compute per-type reach counts as a specific user session (logged in the org audit trail)Scopemanage

Agent grants#

Approving an agent on your app’s consent page creates an agent grant, and the agent’s calls then run as that user under the grant’s allowed queries and globals. See Agent access & grants for how grants work.

RouteDescriptionScope
GET /projects/{id}/agent-grants#List a branch’s agent grants with each grant’s person, queries, globals, expiry and last call (up to 100)Scopemanage
POST /projects/{id}/agent-grants/{grant}/revoke#Revoke an agent grant. The agent’s next call answers 401 invalid_tokenScopemanage
GET /projects/{id}/agent-grants/{grant}/reach#Count the objects a grant can read and change, as the grant’s calls runScopemanage

Live grants appear first, ordered newest first within each group. An empty allowedQueries array means the agent can invoke every deployed query offered to agents on the branch. Listing grants wakes an idle database, and each revocation is logged in your org’s activity.

Reach checks on a grant return the same per-type counts as key reach checks, evaluated as that user’s session with the grant’s ID, globals and read-only setting. Revoked grants return 409 grant_revoked, expired grants return 409 grant_expired, and grants carrying a global no longer listed in grantGlobals return 409 grant_refused. Every check is logged in your org’s activity.

Sign-in and identity providers#

RouteDescriptionScope
GET /projects/{id}/sign-in#Read application branding, allowed redirect URLs, session duration, providers and auth webhooksScoperead
POST /projects/{id}/sign-in#Update application name, brand colors/logos, redirect URLs and session TTLScopemanage
POST /projects/{id}/sign-in/providers#Enable or update an OAuth, OIDC, email/password, magic link or WebAuthn provider. An OIDC provider on main is an SSO connection, charged by the day at the ssoConnection rate.Scopemanage
POST /projects/{id}/sign-in/providers/{provider}/remove#Remove a built-in authentication provider and its settings while keeping existing user accountsScopemanage
POST /projects/{id}/sign-in/providers/oidc/{slug}/remove#Remove a specific custom OpenID Connect provider by slug. The provider’s SSO connection is charged through that day.Scopemanage
POST /projects/{id}/sign-in/webhooks#Register or atomically replace an authentication lifecycle webhook endpointScopemanage
POST /projects/{id}/sign-in/webhooks/remove#Remove an authentication webhook endpointScopemanage
POST /projects/{id}/sign-in/email#Configure custom SMTP settings for verification codes, magic links and password resetsScopemanage

Change-notification webhooks#

RouteDescriptionScope
GET /projects/{id}/webhooks#List configured change-notification webhooks and allowed destination hostsScoperead
POST /projects/{id}/webhooksCreate or update a webhook subscription for one or more schema notify triggersScopemanage
POST /projects/{id}/webhooks/remove#Delete a change-notification webhook subscriptionScopemanage
GET /projects/{id}/webhooks/deliveries#Inspect recent delivery attempts, HTTP status codes and retry stateScoperead
POST /projects/{id}/webhooks/test#Send a synthetic test payload to verify endpoint signature handlingScopemanage
POST /projects/{id}/webhooks/pause#Pause delivery for a webhook while retaining queued positionsScopemanage
POST /projects/{id}/webhooks/resume#Resume delivery for a paused webhook from the last acknowledged position or from nowScopemanage
POST /projects/{id}/webhooks/hosts#Configure the allowlist of outbound HTTPS hostnames permitted for webhooks and actionsScopemanage

POST/projects/{id}/webhooks#

Request body

urlstringrequired
Receiver HTTPS URL up to 2,048 characters. Credentials and URL fragments are rejected. The hostname must pass the branch’s allowed hosts (409 host_not_allowed otherwise).
eventsstring[]required
One to 32 unique notify trigger names declared in the branch’s schema.
keyIduuid | null
Live service key UUID on the branch. Passing keyId registers a rows webhook whose deliveries carry committed rows filtered by that key’s select access rules. Omitting keyId registers a ping webhook.

Subscribe HTTPS endpoints to schema notify triggers (pass ?branch= to configure a non-main branch, up to 128 webhooks per branch or 409 webhook_limit_reached). Every delivery carries an HMAC-SHA256 signature in Napalm-Signature (sha256=<hex>) signed with signingSecretKey, which Napalm shows only in the creation response.

A ping webhook receives a commit notification naming the touched types and commit position. A rows webhook receives committed rows in order from the cluster’s durable change log. Rows webhooks need a change log on the project’s cluster (409 change_log_not_configured when absent, and keepsChangeLog is false on GET /projects/{id}/webhooks) and a single-shard branch (409 branch_distributed on a distributed branch). See webhooks in the TypeScript SDK for delivery contents and signature checks.

Register a rows webhook · curl
curl https://api.napalmdata.com/projects/$PROJECT/webhooks \  -H "Authorization: Bearer $NAPALM_TOKEN" \  -H "Content-Type: application/json" \  -d {    "url": "https://hooks.example.com/napalm",    "events": ["note_changed"],    "keyId": "0b6f1f5e-2a4c-4d7e-9f3b-8c1d2e3f4a5b"  }
Response
{  "url": "https://hooks.example.com/napalm",  "kind": "rows",  "signingSecretKey": "w8rK3mP9xQ2vL7nB4cF1dH6jS0tY5uA8eG3iM2oR9pU"}

Files and S3 imports#

RouteDescriptionScope
GET /projects/{id}/files#Summarize file records per type by status (Ready, Uploading, Empty) and validation errorsScoperead
GET /projects/{id}/files/errors#List the id, reason and status of each file of one type that is not readyScoperead
GET /projects/{id}/file-imports#List S3-compatible bulk file imports with per-type progressScoperead
POST /projects/{id}/file-imports#Plan or start an import populating Empty file records from an external S3 bucketScopemanage
POST /projects/{id}/file-imports/{import}/cancel#Cancel an in-progress file import and immediately purge its encrypted S3 credentialsScopemanage

POST /projects/{id}/file-imports

endpointstringrequired
Public HTTPS URL of the source S3-compatible store (e.g. https://s3.us-east-1.amazonaws.com).
regionstring
Source bucket region (defaults to "auto").
isPathStyleboolean
Use path-style bucket addressing (e.g. for MinIO) instead of virtual-hosted style. Defaults to false.
accessKeyIdstringrequired
Access key with GetObject and ListBucket permissions on the source bucket.
secretAccessKeystringrequired
The access key’s secret. Encrypted on receipt and permanently erased as soon as the import completes, fails or is canceled.
mappingsobject[]required
Up to 50 type mappings specifying how existing Empty records map to source S3 keys.
isAppliedboolean
When true, starts the import. Without it, the request plans: a job counts pending Empty records and probes up to 20 source objects per type without writing data.

Mapping object

typeNamestringrequired
Qualified schema type extending ext::files::File (e.g. default::Photo).
keyPropertystringrequired
String property on the type containing the source S3 object key.
bucketstring
Fixed source bucket name (provide either bucket or bucketProperty).
bucketPropertystring
String property on the type naming each record’s source bucket.
isPublicPropertystring
Optional boolean property indicating whether the imported file should be publicly readable.

Query insights, logs and AI models#

RouteDescriptionScope
GET /projects/{id}/insights#Read the top EdgeQL statements by execution time across cluster members, policy attribution and index adviceScoperead
GET /projects/{id}/insights/latency#Read deployed query call volume and p50/p95 latency breakdowns over up to 30 days (?days=7)Scoperead
GET /projects/{id}/live#List a branch’s open live streams with each stream’s caller and subscriptions, and the project’s subscription count and limitScoperead
GET /projects/{id}/log#Read a branch’s change log progress, size, retention and earliest replay positionScoperead
GET /projects/{id}/changes#Inspect committed change-log entries across a bookmark rangeScopemanage
GET /projects/{id}/changes/lost#Read the transactions a failover or a restore took off a branch’s historyScopemanage
GET /projects/{id}/dropped-logs#List retained change-log archives from deleted branchesScoperead
POST /projects/{id}/dropped-logs/{branch}/remove#Permanently remove a dropped branch’s retained change-log archiveScopemanage
POST /projects/{id}/log-retention#Set the default change-log retention window for the projectScopemanage
GET /projects/{id}/models#Check whether managed AI model providers are configured and view monthly token spendScoperead
POST /projects/{id}/models#Provision Napalm’s managed AI model provider on an existing projectScopemanage

Index recommendations returned in insights.advice can be planned and applied via Schema & branches.

Type a word or two to search every docs page.