Manage

CLI

One binary runs the server and manages everything it serves.

The charter binary is both the production server and the operator toolbox. You may start the API with charter serve or charter dev, import a config, manage users and API keys, and register Model Context Protocol (MCP) clients from the same command.

How it connects#

Management commands talk to the database named by DATABASE_URL directly, the same database the server uses. There is no separate login. Anyone who can reach the database can change the registry. A .env in the current directory is loaded automatically.

Info

For a guided first project, see the Quickstart. Error codes and exit status are documented in the repository guide docs/cli-errors.md and on Errors.

Global flags#

  • -v, --verbose (CHARTER_VERBOSE) — Increase logging detail; repeat for more
  • --json — Print machine-readable JSON instead of columns
  • --env-file PATH (CHARTER_ENV_FILE) — Load env vars from this file [default: ./.env when present]

Commands#

Every command below comes from the live charter binary. Hidden tooling commands are omitted.

charter serve#

Run the production API server

Serves the REST API, the OpenAPI document, the docs page, the llms.txt endpoints, and the MCP endpoint from a single process, backed by the database named by DATABASE_URL (postgres://…), read from the environment or ./.env. DATABASE_URL is required.

CHARTER_SETUP_TOKEN, when set to at least 32 characters, serves /setup until the first operator is created. It has no flag. charter dev ignores it. A shorter value refuses to start.

Every surface is enabled by default; the --no-* flags turn individual ones off. For local work reach for charter dev, which enables everything and prints the URLs on startup.

Flags

  • --host HOST (CHARTER_HOST) [default: 0.0.0.0] — Bind address
  • -p, --port PORT (CHARTER_PORT) [default: 3000] — Port
  • --no-docs (CHARTER_DISABLE_DOCS) — Disable the docs page
  • --no-openapi (CHARTER_DISABLE_OPENAPI) — Disable the OpenAPI document endpoints
  • --no-llms (CHARTER_DISABLE_LLMS) — Disable the /llms.txt and /llms-full.txt endpoints
  • --no-registry (CHARTER_DISABLE_REGISTRY) — Disable the /registry registry endpoints
  • --no-mcp (CHARTER_DISABLE_MCP_SERVER) — Disable the /mcp MCP server endpoint
  • --no-schema-init (CHARTER_DISABLE_SCHEMA_INIT) — Skip applying the database schema on startup
  • --no-console (CHARTER_DISABLE_CONSOLE) — Disable the console
  • --no-organizations (CHARTER_DISABLE_ORGANIZATIONS) — Disable platform organizations
  • --no-invitations (CHARTER_DISABLE_INVITATIONS) — Disable organization invitations
  • --no-sso (CHARTER_DISABLE_SSO) — Disable org-scoped OIDC SSO
  • --no-worker (CHARTER_DISABLE_WORKER) [default: false] — Disable the in-process background job worker
  • --worker-concurrency N (CHARTER_WORKER_CONCURRENCY) [default: 4] — Max in-flight jobs for the embedded worker; ignored with --no-worker
  • --tls-cert PATH_OR_PEM (CHARTER_TLS_CERT) — Server certificate chain (file path or PEM); requires --tls-key
  • --tls-key PATH_OR_PEM (CHARTER_TLS_KEY) — Matching private key (file path or PEM); requires --tls-cert
  • --tls-client-ca PATH_OR_PEM (CHARTER_TLS_CLIENT_CA) — Client trust anchor (file path or PEM); omit for HTTPS without client auth
  • --health-addr ADDR (CHARTER_HEALTH_ADDR) — Plaintext /healthz listener; required when TLS cert and key are set
Examples:
  charter serve
  charter serve --port 8080
  charter serve --no-docs --no-mcp --no-llms
  charter serve --no-console
  charter serve --no-worker
  charter serve --tls-cert /path/to/cert.pem --tls-key /path/to/key.pem \
    --tls-client-ca /path/to/client-ca.pem --health-addr 127.0.0.1:3001

Environment:
  DATABASE_URL                  Postgres URL (required)
  DATABASE_MAX_CONNECTIONS      Pool size [default: 10]
  CHARTER_HTTP_WORKERS          HTTP worker threads [default: available cores]
  CHARTER_STATEMENT_TIMEOUT_MS  Postgres statement_timeout in ms [default: none]
  CHARTER_DISABLE_CONSOLE       Leave /console unmounted (1, true, on, yes)
  CHARTER_DISABLE_ORGANIZATIONS Leave /api/orgs unmounted (1, true, on, yes)
  CHARTER_DISABLE_INVITATIONS   Disable invitation create/accept (1, true, on, yes)
  CHARTER_DISABLE_SSO           Disable org OIDC SSO (1, true, on, yes)
  CHARTER_SETUP_TOKEN           One-time /setup secret, at least 32 characters

charter dev#

Run the API server in development mode

The same server as charter serve, preconfigured for local work: every surface is enabled, the worker count is fixed, and the URLs are printed on startup.

Unlike charter serve, this seeds a control-plane operator on a fresh database and prints their password and API key, so the registry is reachable without any further setup. Running it again against the same database leaves that operator alone; pass --reseed to rotate their password and API key instead. It refuses to run when APP_ENV is production, and separately refuses when the database has control-plane admins other than the dev admin (a signal a fresh dev database doesn't have), unless --force is passed. Binding anything but a loopback address needs COOKIE_SIGNING_KEY set, since the built-in development key is published in Charter's source.

By default the registry file (charter.toml, or --config) stays in step with the database. A resource, field, permission, or webhook added from the CLI, the HTTP API, or MCP is written into the file, and saving the file applies it to the database. Removing a resource from the file drops that resource's data table. Pass --no-watch to leave the file alone.

The database comes from DATABASE_URL when set; otherwise a Compose Postgres URL is derived from CHARTER_API_NAME (or the project slug) and docker compose up -d postgres is run when needed. Use charter serve when you need to size the connection pool or the worker threads from the environment, or to turn surfaces off.

Flags

  • --host HOST (CHARTER_HOST) [default: 127.0.0.1] — Bind address
  • -p, --port PORT (CHARTER_PORT) [default: 3000] — Port
  • --force — Start even if the database has control-plane admins other than [email protected]
  • --reseed — Rotate the dev admin's credentials
  • --config PATH (CHARTER_CONFIG_PATH) [default: charter.toml] — Registry file kept in step with the database
  • --no-watch (CHARTER_NO_WATCH) [default: false] — Do not mirror the registry file and the database
Examples:
  charter dev
  charter dev --port 8080
  charter dev --host 0.0.0.0   # container workflows; needs COOKIE_SIGNING_KEY
  charter dev --reseed   # rotate the dev admin's password and API key
  charter dev --no-watch
  charter dev --config ./api.toml

charter work#

Run a background job worker

Claims jobs from the queues below and runs them, until interrupted. Every first-party job type is registered, so one worker with no flags handles everything the API dispatches: webhook deliveries and CSV import batches.

Run this as its own process alongside charter serve --no-worker when job throughput should scale independently of HTTP throughput; several workers can share the same queues without ever processing a job twice. charter serve (worker on by default) and charter dev run the same worker in-process instead, which is enough for a single-process deployment.

Applies the database schema first, the same way charter serve does (safe to re-run). The database comes from DATABASE_URL (required).

Flags

  • --queue NAME (CHARTER_WORK_QUEUES) — Queue to consume; repeat to add more [default: every queue a first-party job uses]
  • -c, --concurrency N (CHARTER_WORK_CONCURRENCY) [default: 4] — Max jobs to run at once
  • --visibility-timeout SECS (CHARTER_WORK_VISIBILITY_TIMEOUT) — Seconds before a claimed job is considered crashed and offered to another worker [default: 300]
Examples:
  charter work
  charter work --queue webhooks --concurrency 8
  charter work --queue imports --visibility-timeout 900

charter migrate#

Apply the database schema

Applies any pending schema migrations to the database named by DATABASE_URL (required), tracked in the metadata_migrations table. Safe to re-run: already-applied migrations are skipped.

--reset is only for starting over: it drops every Charter-managed table and rebuilds the schema from scratch, destroying all data in them.

This applies the schema only. Resource, field, permission, and webhook definitions are loaded separately with charter import config.

Flags

  • --reset — Drop every Charter-managed table, then recreate the schema
  • --yes — Confirm a destructive --reset without prompting
Examples:
  charter migrate
  charter migrate --reset --yes
  charter --env-file=prod.env migrate

charter health#

Check that Charter is configured to run

Reports the effective database target from DATABASE_URL (required), with --connect that the database on the other end actually answers, and with --migrations that the schema is up to date. Exits non-zero when the connection check fails.

This is what the container image's HEALTHCHECK runs: the distroless image has no shell or curl, so the binary has to probe on its own behalf.

Flags

  • --connect — Also open a connection and ping the database
  • --migrations — Also report whether every schema migration has been applied
Examples:
  charter health
  charter health --connect
  charter health --connect --migrations
  charter --env-file=prod.env health --connect

charter upgrade#

Replace this charter binary with a published release

With no version, fetches https://downloads.charterapp.dev/latest.json and installs that release when it is newer than this binary. Pass a version to install that release instead, including an older one.

The archive is chosen for this machine: Linux musl or macOS, x86_64 or aarch64. SHA256SUMS is checked before the running binary is replaced. Homebrew installs are left alone.

CHARTER_DOWNLOADS_URL overrides the download origin. It is not CHARTER_BASE_URL, which is the API's public address.

Flags

  • VERSION — Version to install, such as 1.2.0 or v1.2.0
Examples:
  charter upgrade
  charter upgrade 1.2.0
  charter upgrade v1.2.0
  charter upgrade --json
  CHARTER_DOWNLOADS_URL=https://downloads.example charter upgrade

charter import#

Import a configuration file or a spreadsheet into the database

config upserts a TOML registry file. excel and csv read a spreadsheet instead, creating one resource per sheet (or per CSV file) with a field per column, and with --data loading the file's rows too.

Every subcommand reports what it would import and writes nothing until you pass --apply. Spreadsheet dry runs need no database; config previews a live diff against the one named by DATABASE_URL. --apply talks to that database.

Examples:
  charter import config
  charter import config --path examples/config.toml --apply
  charter import config --path examples/config.toml --apply --prune --yes
  CHARTER_CONFIG_PATH=./charter.toml charter import config --apply
  charter import excel --path ./sales.xlsx
  charter import excel --path ./sales.xlsx --data
  charter import excel --path ./sales.xlsx --sheet Orders --resource orders --apply --data
  charter import csv --path ./people.csv --apply --data
  charter work --queue imports

charter import config#

Import a TOML configuration file

Compares the file to the live database and writes nothing unless --apply is given. The report lists created, updated, unchanged, and would-remain rows.

With --apply, the database schema is applied if it isn't already there, then the file's resources, fields, permissions, and webhooks are upserted. Rows in the database but missing from the file are left alone: this is an upsert, not a sync, and does not delete.

Re-running with an edited file creates or updates the rows the file names. Removing a resource, field, permission, or webhook from the file does not take it off the live API unless you also pass --prune.

Flags

  • --path PATH (CHARTER_CONFIG_PATH) [default: charter.toml] — Path to the TOML configuration file
  • --apply — Upsert the definitions, instead of only reporting them
  • --prune — Delete live rows that the file does not name
  • --yes — Confirm --prune without prompting

charter import excel#

Create resources and fields from a spreadsheet's sheets

Every sheet becomes a resource named after the sheet, and every column in its first row becomes a field, typed from the values below it.

Reports what it would create and writes nothing unless --apply is given.

Flags

  • --path PATH (required) — Path to the .xlsx, .xls, .xlsb, or .ods workbook
  • --sheet NAME — Only this sheet [default: every sheet]
  • --resource NAME — Resource name to use instead of the slugified sheet name
  • --apply — Create the resources and fields, instead of only reporting them
  • --data — Bring the sheet's rows into scope as well as its columns

charter import csv#

Create a resource and fields from a CSV file's header row

Every column becomes a string field: a CSV carries no type information.

Reports what it would create and writes nothing unless --apply is given.

Flags

  • --path PATH (required) — Path to the CSV file
  • --resource NAME — Resource name to use instead of the slugified file name
  • --apply — Create the resource and its fields, instead of only reporting them
  • --data — Bring the file's rows into scope as well as its columns

charter setup#

Set up a new Charter project

Writes a .env with a Compose Postgres DATABASE_URL, signing key, and MCP role; a compose.yaml with Postgres and a Grafana/OTel stack; and a .gitignore that keeps the .env out of git. Prompts for an API name, offers to start a git repository, and prints the command that registers the MCP server with any agent CLI found on this machine.

Safe to re-run: a file that already exists is left alone and reported as skipped, unless --force is given. Run charter dev next (it starts Postgres from compose.yaml when needed).

Flags

  • PATH — Directory to set up, created if missing [default: the current directory]
  • -y, --yes — Skip every prompt and take the default at each one
  • --force — Overwrite files that already exist instead of skipping them
Examples:
  charter setup
  charter setup my-api
  charter setup --yes

charter export#

Export the live configuration to a file

Reconstructs the resources, fields, permissions, and webhooks currently in the database named by DATABASE_URL as a TOML configuration file — the inverse of charter import config.

An existing file is never overwritten: the command fails instead, so a stale export cannot silently replace a file you meant to keep.

Use it to capture a running API's definition, check it into version control, or re-apply it to another environment.

Flags

  • --path PATH (CHARTER_EXPORT_PATH) [default: charter.toml] — Path of the configuration file to write; must not already exist
Examples:
  charter export
  charter export --path ./out.toml
  CHARTER_EXPORT_PATH=./out.toml charter export

charter mcp#

Run an MCP server over stdio

Without a subcommand, serves the admin/operator tool surface (schema plus data reads as CHARTER_MCP_ROLE). charter mcp api serves the end-user Resource MCP: record CRUD as the principal named by CHARTER_API_KEY or --api-key (a crt_… key or Bearer access token).

stdout carries JSON-RPC and nothing else; the startup banner goes to stderr, and only when a terminal is attached. charter serve exposes admin tools at /mcp and Resource MCP at /v1/mcp.

Flags

  • --no-schema-init (CHARTER_DISABLE_SCHEMA_INIT) — Skip applying the database schema on startup
Examples:
  charter mcp
  charter mcp api --api-key "$CHARTER_API_KEY"

Admin MCP (schema tools) — register with a coding agent:
  claude mcp add charter -- charter mcp
  codex mcp add charter -- charter mcp
  gemini mcp add -s project charter -- charter mcp

Resource MCP (record CRUD as your API key):
  claude mcp add charter-api -e CHARTER_API_KEY -- charter mcp api
  codex mcp add charter-api --env CHARTER_API_KEY -- charter mcp api
  gemini mcp add -s project charter-api -- charter mcp api

With a .env from `charter setup`:
  claude mcp add charter -- charter --env-file .env mcp
  claude mcp add charter-api -e CHARTER_API_KEY -- charter --env-file .env mcp api

Or add this to claude_desktop_config.json for Resource MCP:

{
  "mcpServers": {
    "charter-api": {
      "command": "charter",
      "args": ["mcp", "api"],
      "env": {
        "CHARTER_API_KEY": "crt_…"
      }
    }
  }
}

charter mcp api#

Resource MCP: record CRUD as an API principal

Authenticates with CHARTER_API_KEY or --api-key (a crt_… API key, or a short-lived access token). Every tool call enforces that user's role and permissions — the same rules as REST /v1. No schema or admin tools.

Flags

  • --api-key API_KEY (CHARTER_API_KEY) — API key (crt_…) or access token for the Resource MCP principal

charter service-account#

Manage service accounts and their API keys

A service account is a user with no password or session, so it owns API keys without an owner whose departure revokes them — the right credential for CI and other automation.

Examples:
  charter service-account create
  charter service-account create --email [email protected] --name ci --role agent
  charter service-account ls
  charter service-account ls --json
  charter service-account key create --email [email protected]
  charter service-account disable --email [email protected]
  charter service-account delete --email [email protected] --yes
  charter service-account key revoke --id 00000000-0000-0000-0000-000000000000 --yes

charter service-account create#

Create a service account

Omit any of --email, --name, or --role on a terminal and this asks for it; when stdin isn't a terminal, or under --json, a missing one is an error instead — a script must never be answered by a prompt.

Flags

  • --email EMAIL — Address that identifies the account, e.g. [email protected]
  • --name NAME — Display name, e.g. ci; omit it to be prompted
  • --role ROLE — Role matched against the permissions table, e.g. agent

charter service-account ls#

List every service account

charter service-account disable#

Stop a service account's keys from authenticating, reversibly

Flags

  • --email EMAIL (required)

charter service-account enable#

Re-enable a disabled service account

Flags

  • --email EMAIL (required)

charter service-account delete#

Delete a service account and, by cascade, every key it owns

Refused without --yes. Irreversible: the account and every key it owns go together.

Flags

  • --email EMAIL (required)
  • --yes — Confirm the deletion without prompting

charter service-account key#

Manage a service account's API keys

charter service-account key create#

Mint a key; the plaintext is printed once and never stored

Flags

  • --email EMAIL — Service account email; omit it to pick from a list
  • --label LABEL — Optional label for the key
  • --expires-at EXPIRES_AT — When the key stops working (RFC 3339). Omit for no expiry
charter service-account key ls#

List a service account's keys (never shows key material)

Flags

  • --email EMAIL (required)
charter service-account key revoke#

Permanently delete one key by id

Refused without --yes. Irreversible: the key cannot authenticate again once deleted.

Flags

  • --id ID (required)
  • --yes — Confirm the revocation without prompting

charter admin#

Manage control-plane operators

An admin is a user carrying a control-plane mark, so the session cookie or API key they already use on the data plane also reaches the registry, the metadata surface, and the ledger. The mark is independent of the role column. This command sets it. The one-time /setup page can set it once, when CHARTER_SETUP_TOKEN is configured and no operator exists yet.

Examples:
  charter admin create
  charter admin create --email [email protected] --name 'Jane Doe'
  charter admin create --email [email protected] --name 'Jane Doe' --password 'hunter2'
  charter admin ls
  charter admin ls --json
  charter admin grant --email [email protected]
  charter admin revoke --email [email protected]
  charter admin key create --email [email protected] --label laptop
  charter admin key revoke --id 00000000-0000-0000-0000-000000000000 --yes

charter admin create#

Create an admin user and mint their first API key

The key is printed once and never stored. Omit --email or --name on a terminal and this asks for them; when stdin isn't a terminal, or under --json, a missing one is an error instead — a script must never be answered by a prompt.

Flags

  • --email EMAIL — Omit it to be prompted
  • --name NAME — Omit it to be prompted
  • --password PASSWORD — Set a password so they can also sign in

charter admin ls#

List admins and when each was granted access

charter admin grant#

Grant an existing user control-plane access

Idempotent: an admin already marked keeps their original grant time.

Flags

  • --email EMAIL (required)

charter admin revoke#

Take control-plane access away from a user

Effective on their next request. This does not ban the user: their account, sessions, and API keys keep working on the data plane.

Flags

  • --email EMAIL (required)

charter admin key#

Manage an admin's API keys

charter admin key create#

Mint a key; the plaintext is printed once and never stored

Flags

  • --email EMAIL — Admin email; omit it to pick from a list
  • --label LABEL — Optional label for the key
  • --expires-at EXPIRES_AT — When the key stops working (RFC 3339). Omit for no expiry
charter admin key ls#

List an admin's keys (never shows key material)

Flags

  • --email EMAIL (required)
charter admin key revoke#

Permanently delete one key by id

Refused without --yes. Irreversible: the key cannot authenticate again once deleted.

Flags

  • --id ID (required)
  • --yes — Confirm the revocation without prompting

charter resources#

Manage registry resources, their backing data tables, and their bound fields

A resource is a named collection backed by its own Postgres jsonb table. A field is bound to a resource with attach, which layers per-resource rules (required, sortable, searchable, unique, …) onto a shared field definition managed by charter fields. This talks to Postgres directly, the same way charter admin and charter service-account do, rather than through the HTTP metadata API.

Examples:
  charter resources create
  charter resources create posts --description 'Blog posts'
  charter resources ls
  charter resources ls --json
  charter resources view posts
  charter resources disable posts
  charter resources fields posts
  charter resources attach posts slug --required --unique
  charter resources update-field posts slug --sortable
  charter resources detach posts slug --yes
  charter resources delete posts --yes

charter resources ls#

List every resource

charter resources view#

Show one resource with its fields and permissions

Flags

  • NAME (required) — Resource id or name

charter resources create#

Create a resource and its backing data table

Omit the name on a terminal and this asks for every value it wasn't given. Under --json, or when stdin isn't a terminal, a missing name is an error instead — a script must never be answered by a prompt.

Flags

  • NAME — Name: a lowercase letter or underscore, then lowercase letters, digits, or underscores
  • --description DESCRIPTION — Optional human description
  • --enabled — Create it available for reads and writes (the default)
  • --disabled — Create it without making it available yet
  • --read-only — Mark the resource as rejecting writes
  • --allow-anonymous — Let requests with no credentials read this resource

charter resources enable#

Make a resource available for reads and writes

A running server caches resource lookups for 60s, so this takes up to that long to take effect.

Flags

  • NAME (required) — Resource id or name

charter resources disable#

Stop a resource being read or written through the API

A running server caches resource lookups for 60s, so this takes up to that long to take effect.

Flags

  • NAME (required) — Resource id or name

charter resources delete#

Delete a resource; its bindings, permissions, and data table go with it

Refused without --yes. Irreversible: the physical data table and every row in it are dropped, so a later resource reusing the name starts empty. The field definitions it used are untouched — they may still be bound to other resources.

Flags

  • NAME (required) — Resource id or name
  • --yes — Confirm the deletion without prompting

charter resources fields#

List the fields attached to a resource

Flags

  • RESOURCE (required) — Resource id or name

charter resources attach#

Bind an existing field definition onto a resource

The field must already exist — create it first with charter fields create. Omit the resource or field on a terminal and this asks for whichever is missing. Under --json, or when stdin isn't a terminal, a missing one is an error instead.

Flags

  • RESOURCE — Resource id or name; omit it to be prompted
  • FIELD — Field id or name; omit it to be prompted
  • --required — Reject writes that omit this field (the default is optional)
  • --optional — Allow writes that omit this field (the default)
  • --sortable — Provision a btree index so this field can be sorted on
  • --not-sortable — Leave this field unsortable (the default)
  • --searchable — Mark this field as usable in text search
  • --not-searchable — Leave this field out of text search (the default)
  • --unique — Provision a unique btree index enforcing distinct values
  • --not-unique — Allow duplicate values (the default)
  • --default-value DEFAULT_VALUE — Default value, as a JSON scalar, array, or object
  • --validations VALIDATIONS — Validation rules, as a JSON array
  • --generated-from GENERATED_FROM — Generation rule for a computed field, as a JSON object; its source_field must name another field already bound to this resource

charter resources update-field#

Update a resource's rules for an already-bound field

Flags

  • RESOURCE — Resource id or name; omit it to be prompted
  • FIELD — Field id or name; omit it to be prompted
  • --required — Reject writes that omit this field
  • --optional — Allow writes that omit this field
  • --sortable — Provision a btree index so this field can be sorted on
  • --not-sortable — Drop this field's sortable index, if it has one
  • --searchable — Mark this field as usable in text search
  • --not-searchable — Leave this field out of text search
  • --unique — Provision a unique btree index enforcing distinct values
  • --not-unique — Drop uniqueness, allowing duplicate values
  • --default-value DEFAULT_VALUE — Set the default value, as a JSON scalar, array, or object
  • --validations VALIDATIONS — Set the validation rules, as a JSON array
  • --generated-from GENERATED_FROM — Set the generation rule for a computed field, as a JSON object
  • --clear-generated-from — Clear the generation rule back to none

charter resources detach#

Detach a field from a resource

Refused without --yes. The field definition is untouched — this only removes this resource's binding to it, along with the resource's own per-field data index, if it had one.

Flags

  • RESOURCE — Resource id or name; omit it to be prompted
  • FIELD — Field id or name; omit it to be prompted
  • --yes — Confirm the detach without prompting

charter fields#

Manage reusable field definitions

A field definition is resource-agnostic: charter resources attach binds one onto a resource with that resource's own rules. This talks to Postgres directly, the same way charter resources does, rather than through the HTTP metadata API.

Examples:
  charter fields create
  charter fields ls
  charter fields ls --json
  charter fields view title
  charter fields create slug --type string
  charter fields update slug --display-name Slug
  charter fields delete slug --yes

charter fields ls#

List every field definition

charter fields view#

Show one field definition

Flags

  • FIELD (required) — Field id or name

charter fields create#

Create a field definition

A new definition is not bound to any resource yet: run charter resources attach <resource> <name> next to make it usable there.

Omit the name or type on a terminal and this asks for every value it wasn't given. Under --json, or when stdin isn't a terminal, a missing one is an error instead.

Flags

  • NAME — Name: a letter or underscore, then letters, digits, or underscores
  • --type TYPE — Field type, e.g. string, number, boolean, datetime, timestamp, json, uuid, text, enum, relation
  • --display-name DISPLAY_NAME — Human-readable label shown in place of the field name
  • --description DESCRIPTION — Optional human description
  • --content-type CONTENT_TYPE — MIME type hint for the field's value
  • --enum-values ENUM_VALUES — Allowed values for an enum field; repeat or separate with commas
  • --relations RELATIONS — Relation config for a relation field, as a JSON object

charter fields update#

Update a field definition

The field's name can't be changed here — there is no --name flag. Changing --type is refused while the field is bound to any resource: detach it everywhere first.

Flags

  • FIELD (required) — Field id or name
  • --type TYPE — Field type, e.g. string, number, boolean, datetime, timestamp, json, uuid, text, enum, relation
  • --display-name DISPLAY_NAME — Set the human-readable label shown in place of the field name
  • --clear-display-name — Clear the display name back to none
  • --description DESCRIPTION — Set the human description
  • --clear-description — Clear the description back to none
  • --content-type CONTENT_TYPE — Set the MIME type hint for the field's value
  • --clear-content-type — Clear the content type back to none
  • --enum-values ENUM_VALUES — Set the allowed values for an enum field; repeat or separate with commas
  • --relations RELATIONS — Set the relation config for a relation field, as a JSON object
  • --clear-relations — Clear the relation config back to none

charter fields delete#

Delete a field definition

Refused without --yes, and refused while the field is still bound to any resource — detach it everywhere first. Existing rows keep the key in their data column either way; nothing in this codebase strips it.

Flags

  • FIELD (required) — Field id or name
  • --yes — Confirm the deletion without prompting

charter permissions#

Manage a resource's role-based access rules

A permission grants one role the ability to perform one action (create, read, update, delete) against one resource, scoped to a set of visible fields and optional filter/check predicates. This talks to Postgres directly, the same way charter resources and charter fields do, rather than through the HTTP metadata API.

Examples:
  charter permissions ls posts
  charter permissions ls --role editor
  charter permissions view posts editor read
  charter permissions create
  charter permissions create posts editor read --fields title,body
  charter permissions update posts editor read --fields title,body,slug
  charter permissions delete posts editor read --yes

charter permissions ls#

List permissions, optionally scoped to one resource

Flags

  • RESOURCE — Resource id or name; omit to list every permission across every resource
  • --role ROLE — Only permissions granted to this role

charter permissions view#

Show one permission

Flags

  • RESOURCE (required) — Resource id or name
  • ROLE (required) — Role this permission is granted to
  • ACTION (required) — Action this permission grants: create, read, update, or delete

charter permissions create#

Grant a role permission to perform an action on a resource

import is not grantable here: the registry validates action against the same create/read/update/delete allow-list the HTTP API uses — only charter import config produces an import-actioned permission. This passes action straight through unvalidated so an out-of-vocabulary value gets the same multi-line validation error the HTTP API would.

Omit any of the four values on a terminal and this asks for them. Under --json, or when stdin isn't a terminal, a missing one is an error instead — including --fields, whose absence must never be mistaken for "grant everything".

Flags

  • RESOURCE — Resource id or name; omit it to pick from a list
  • ROLE — Role to grant; omit it to be prompted
  • ACTION — Action to grant: create, read, update, or delete
  • --fields FIELDS — Fields visible to this role for this action; comma-separated or repeated
  • --filters FILTERS — Row-level filter predicates, as a JSON array
  • --checks CHECKS — Field-level check predicates, as a JSON array. On create/update, eq checks with a claim or value are written onto the row

charter permissions update#

Update a permission's fields, filters, or checks

The role and action can't be changed here — there is no --role or --action flag — because this command addresses the row by RESOURCE ROLE ACTION; renaming either would leave the updated row no longer described by its own arguments. Delete and re-create to change either.

Flags

  • RESOURCE (required) — Resource id or name
  • ROLE (required) — Role this permission is granted to
  • ACTION (required) — Action this permission grants: create, read, update, or delete
  • --fields FIELDS — Set the fields visible to this role for this action; comma-separated or repeated. Omit to leave unchanged
  • --filters FILTERS — Set the row-level filter predicates, as a JSON array
  • --clear-filters — Clear the filter predicates back to none
  • --checks CHECKS — Set the field-level check predicates, as a JSON array. On create/update, eq checks with a claim or value are written onto the row (overriding any client-supplied value)
  • --clear-checks — Clear the check predicates back to none

charter permissions delete#

Revoke a permission

Refused without --yes. If this removes the resource's last permission, the resource is left with no permissions at all: every role gets 403 on every action, with no admin bypass, until a new permission is created.

Flags

  • RESOURCE (required) — Resource id or name
  • ROLE (required) — Role this permission is granted to
  • ACTION (required) — Action this permission grants: create, read, update, or delete
  • --yes — Confirm the deletion without prompting

charter webhooks#

Manage outbound webhooks

A webhook is a URL Charter POSTs to when a record event matches its pattern. This talks to the database directly, the same way charter resources does, rather than through the HTTP metadata API. Signing secrets are not set or shown here.

Examples:
  charter webhooks create
  charter webhooks create posts-hook --url https://hooks.example.com/posts --event-pattern 'posts.*'
  charter webhooks ls
  charter webhooks ls --json
  charter webhooks view posts-hook
  charter webhooks update posts-hook --url https://hooks.example.com/v2
  charter webhooks disable posts-hook
  charter webhooks delete posts-hook --yes

charter webhooks ls#

List every webhook

charter webhooks view#

Show one webhook

Flags

  • NAME (required) — Webhook id or name

charter webhooks create#

Create a webhook

Omit the name, URL, or event pattern on a terminal and this asks for whichever is missing. Under --json, or when stdin isn't a terminal, a missing one is an error instead.

Flags

  • NAME — Name. Omit it to be prompted
  • --url URL — URL to POST events to
  • --event-pattern EVENT_PATTERN — Events to deliver, such as posts.*
  • --enabled — Create it enabled (the default)
  • --disabled — Create it without delivering events yet
  • --headers HEADERS — Extra request headers, as a JSON object of strings
  • --retry RETRY — Retry policy, as a JSON object
  • --field-ids FIELD_IDS — Field names to keep on before/after in deliveries (not UUIDs)

charter webhooks update#

Change a webhook's URL, pattern, headers, retry policy, or fields

Flags

  • NAME (required) — Webhook id or name
  • --url URL — Replacement URL
  • --event-pattern EVENT_PATTERN — Replacement event pattern
  • --headers HEADERS — Replacement headers, as a JSON object of strings
  • --clear-headers — Remove the headers
  • --retry RETRY — Replacement retry policy, as a JSON object
  • --clear-retry — Remove the retry policy
  • --field-ids FIELD_IDS — Replacement field names to keep on before/after (not UUIDs)
  • --clear-field-ids — Stop trimming deliveries; send the full record again

charter webhooks enable#

Deliver events for a webhook

Flags

  • NAME (required) — Webhook id or name

charter webhooks disable#

Stop delivering events for a webhook

Flags

  • NAME (required) — Webhook id or name

charter webhooks delete#

Delete a webhook

Refused without --yes. Irreversible: deliveries already queued are dropped when they next run, because the row is gone.

Flags

  • NAME (required) — Webhook id or name
  • --yes — Confirm the deletion without prompting

charter users#

Manage accounts

A user can sign in when they have a password, and can call the API when they hold a key from charter api-keys. The role column is matched against permissions. Operator access is separate: use charter admin.

Examples:
  charter users create
  charter users create --email [email protected] --name 'Jane Doe' --role editor
  charter users create --email [email protected] --name 'Jane Doe' --password 'hunter2'
  charter users ls
  charter users ls --json
  charter users view [email protected]
  charter users update [email protected] --role editor
  charter users disable [email protected]
  charter users delete [email protected] --yes

charter users ls#

List users

Flags

  • --limit LIMIT [default: 100] — How many users to return
  • --offset OFFSET [default: 0] — How many users to skip

charter users view#

Show one user

Flags

  • EMAIL (required) — User id or email

charter users create#

Create a user

Omit --email or --name on a terminal and this asks for them. Under --json, or when stdin isn't a terminal, a missing one is an error instead. This does not grant operator access and does not mint an API key.

Flags

  • --email EMAIL — Omit it to be prompted
  • --name NAME — Omit it to be prompted
  • --role ROLE — Role matched against the permissions table
  • --password PASSWORD — Set a password so they can sign in

charter users update#

Change a user's name or role

Flags

  • EMAIL (required) — User id or email
  • --name NAME — Replacement display name
  • --role ROLE — Replacement role
  • --clear-role — Remove the role

charter users enable#

Let a user's keys and sessions authenticate again

Flags

  • EMAIL (required) — User id or email

charter users disable#

Stop a user's keys and sessions from authenticating

Flags

  • EMAIL (required) — User id or email

charter users delete#

Delete a user and, by cascade, every key and session they own

Refused without --yes. Irreversible.

Flags

  • EMAIL (required) — User id or email
  • --yes — Confirm the deletion without prompting

charter api-keys#

Manage API keys

A key authenticates as the user who owns it. The plaintext is printed once at creation and never stored. Listing shows the prefix, never the secret.

Examples:
  charter api-keys create --email [email protected] --label laptop
  charter api-keys ls --email [email protected]
  charter api-keys ls --email [email protected] --json
  charter api-keys revoke --id 00000000-0000-0000-0000-000000000000 --yes

charter api-keys create#

Mint a key; the plaintext is printed once and never stored

Flags

  • --email EMAIL — User email; omit it to pick from a list
  • --label LABEL — Optional label for the key
  • --expires-at EXPIRES_AT — When the key stops working (RFC 3339). Omit for no expiry

charter api-keys ls#

List a user's keys (never shows key material)

Flags

  • --email EMAIL (required) — User email

charter api-keys revoke#

Permanently delete one key by id

Refused without --yes. Irreversible: the key cannot authenticate again once deleted.

Flags

  • --id ID (required)
  • --yes — Confirm the revocation without prompting

charter roles#

List roles named on accounts and permission rows

A role is a string. This gathers the ones on user accounts and the ones named by permission rows, with how many accounts carry each and which resource · action grants mention it.

Examples:
  charter roles ls
  charter roles ls --json
  charter roles view editor

charter roles ls#

List every role

charter roles view#

Show one role

Flags

  • ROLE (required) — Role name

charter org#

Manage organizations

Examples:
  charter org ls
  charter org create --name Acme --slug acme
  charter org view acme

charter org ls#

List organizations

Flags

  • --limit LIMIT [default: 100]
  • --offset OFFSET [default: 0]

charter org create#

Create an organization

Flags

  • --name NAME (required)
  • --slug SLUG

charter org view#

Show one organization by id or slug

Flags

  • ID_OR_SLUG (required)

charter license#

Store or refresh the license key from the account page.

The key is created on the website after signup and payment. This command checks the signature and stores the key. It does not generate one.

Examples:
  charter license set v4.public.example
  charter license refresh

charter license set#

Check a license key and store it

Flags

  • TOKEN — The license key. Omit to use CHARTER_LICENSE_KEY

charter license refresh#

Re-read this license from the license server

Reading records#

The CLI manages the registry, accounts and keys. Records themselves are read and written over REST or MCP.

API key plaintext is printed once, when the key is minted. Only its hash is stored.

Errors#

Every failure prints a stable code such as config.invalid_file, and the process exits with a code for its category. With --json, the error is printed as JSON too.