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.
| Route | Description | Scope |
|---|---|---|
GET /projects# | List all projects in the organization with cluster assignment and API status | Scoperead |
POST /projects | Create a new project by name and return the project’s initial verification operation | Scopemanage |
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.
curl https://api.napalmdata.com/projects \ -H "Authorization: Bearer $NAPALM_TOKEN" \ -H "Content-Type: application/json" \ -d { "name": "notes" }{ "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#
| Route | Description | Scope |
|---|---|---|
GET /# | Read the project API URL and current API settings (pass ?branch= to inspect a branch) | Scoperead |
POST /# | Enable or disable the project API and update CORS origins, globals, passthrough or limits | Scopemanage |
POST /projects/{id}/endpoint
- isActivebooleanrequired
- Enables or disables the project API. Every branch has
ext::napalmfrom 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
localhostor127.0.0.1for 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 adenyrule alone. - branchstring
- Target branch name when configuring a non-main branch endpoint.
Service keys#
| Route | Description | Scope |
|---|---|---|
GET /projects/{id}/keys# | List service key metadata (id, label, branch, read-only flag and expiration) | Scoperead |
POST /projects/{id}/keys | Issue a new service key (returns the plaintext ndb_… token once) | Scopemanage |
POST /# | Revoke a service key | Scopemanage |
GET /# | Read per-key activity on a branch: calls, writes, failed calls, first use and last use | Scoperead |
GET /# | Read one key’s history by hour and day, with failures, addresses and queries | Scoperead |
POST /# | Set how many days a branch keeps a key’s hourly and daily counts | Scopemanage |
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 (
mainwhen 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’sserviceGlobalsso 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 / and revoke a key with POST /. 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 / 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 / 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 / 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.
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" } }{ "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.
| Route | Description | Scope |
|---|---|---|
GET /# | Count readable, updatable and deletable objects per type for an existing key | Scoperead |
GET /# | Preview reach counts for a prospective key (?isReadOnly=true&branch=pr-12) | Scoperead |
POST /# | 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 /# | Search registered user identities on a branch by email substring, ID or subject (up to 50) | Scopemanage |
GET /# | 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.
| Route | Description | Scope |
|---|---|---|
GET /# | List a branch’s agent grants with each grant’s person, queries, globals, expiry and last call (up to 100) | Scopemanage |
POST /# | Revoke an agent grant. The agent’s next call answers 401 invalid_token | Scopemanage |
GET /# | Count the objects a grant can read and change, as the grant’s calls run | Scopemanage |
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#
| Route | Description | Scope |
|---|---|---|
GET /# | Read application branding, allowed redirect URLs, session duration, providers and auth webhooks | Scoperead |
POST /# | Update application name, brand colors/logos, redirect URLs and session TTL | Scopemanage |
POST /# | 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 /# | Remove a built-in authentication provider and its settings while keeping existing user accounts | Scopemanage |
POST /# | Remove a specific custom OpenID Connect provider by slug. The provider’s SSO connection is charged through that day. | Scopemanage |
POST /# | Register or atomically replace an authentication lifecycle webhook endpoint | Scopemanage |
POST /# | Remove an authentication webhook endpoint | Scopemanage |
POST /# | Configure custom SMTP settings for verification codes, magic links and password resets | Scopemanage |
Change-notification webhooks#
| Route | Description | Scope |
|---|---|---|
GET /# | List configured change-notification webhooks and allowed destination hosts | Scoperead |
POST / | Create or update a webhook subscription for one or more schema notify triggers | Scopemanage |
POST /# | Delete a change-notification webhook subscription | Scopemanage |
GET /# | Inspect recent delivery attempts, HTTP status codes and retry state | Scoperead |
POST /# | Send a synthetic test payload to verify endpoint signature handling | Scopemanage |
POST /# | Pause delivery for a webhook while retaining queued positions | Scopemanage |
POST /# | Resume delivery for a paused webhook from the last acknowledged position or from now | Scopemanage |
POST /# | Configure the allowlist of outbound HTTPS hostnames permitted for webhooks and actions | Scopemanage |
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_allowedotherwise). - eventsstring[]required
- One to 32 unique
notifytrigger names declared in the branch’s schema. - keyIduuid | null
- Live service key UUID on the branch. Passing
keyIdregisters arowswebhook whose deliveries carry committed rows filtered by that key’sselectaccess rules. OmittingkeyIdregisters apingwebhook.
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 /) and a single-shard branch (409 branch_distributed on a distributed branch). See webhooks in the TypeScript SDK for delivery contents and signature checks.
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" }{ "url": "https://hooks.example.com/napalm", "kind": "rows", "signingSecretKey": "w8rK3mP9xQ2vL7nB4cF1dH6jS0tY5uA8eG3iM2oR9pU"}Files and S3 imports#
| Route | Description | Scope |
|---|---|---|
GET /projects/{id}/files# | Summarize file records per type by status (Ready, Uploading, Empty) and validation errors | Scoperead |
GET /# | List the id, reason and status of each file of one type that is not ready | Scoperead |
GET /# | List S3-compatible bulk file imports with per-type progress | Scoperead |
POST /# | Plan or start an import populating Empty file records from an external S3 bucket | Scopemanage |
POST /# | Cancel an in-progress file import and immediately purge its encrypted S3 credentials | Scopemanage |
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#
| Route | Description | Scope |
|---|---|---|
GET /# | Read the top EdgeQL statements by execution time across cluster members, policy attribution and index advice | Scoperead |
GET /# | 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 limit | Scoperead |
GET /projects/{id}/log# | Read a branch’s change log progress, size, retention and earliest replay position | Scoperead |
GET /# | Inspect committed change-log entries across a bookmark range | Scopemanage |
GET /# | Read the transactions a failover or a restore took off a branch’s history | Scopemanage |
GET /# | List retained change-log archives from deleted branches | Scoperead |
POST /# | Permanently remove a dropped branch’s retained change-log archive | Scopemanage |
POST /# | Set the default change-log retention window for the project | Scopemanage |
GET /# | Check whether managed AI model providers are configured and view monthly token spend | Scoperead |
POST /# | Provision Napalm’s managed AI model provider on an existing project | Scopemanage |
Index recommendations returned in insights.advice can be planned and applied via Schema & branches.