mapbench
Contents

Documentation → Reference

API keys, scopes and projects

The mapbench management API accepts two kinds of credential: an API key, which you create and paste in yourself, and an OAuth connector, which an agent gets by sending you to an approval screen. Both act as you, in one project, with only the scopes they were given.

The two kinds of credential

API keyOAuth connector
looks liketp_… in an Authorization: Bearer headera connection you approve in the agent's UI
forscripts, Claude Code, anything you run yourselfhosted agents that sign in on your behalf
you see what it can dowhen you create iton an approval screen, every time
can publish share linksno (not in any preset)yes, if you approved it
revoke fromAccount → API keysAccount → connectors

You create and revoke both on your Account page. Each is shown once, and mapbench keeps no copy it can show you again. If you lose one, revoke it and create another.

Scopes

A scope is a permission. Scopes can only narrow what you can already do. A credential never has more access than the person who created it, and it loses access as soon as that person does.

ScopeGrants
readSee your datasets, models and maps, and run read-only SQL over them
datasets:writeAdd and change datasets, their styling and folders
models:writeCreate and change SQL models
maps:writeCreate and change maps and their layers
jobs:writeCancel queued processing jobs
deleteDelete datasets, models and maps
share:writeCreate and revoke public share links to maps and datasets
projects:writeCreate and rename projects, and move this connection between the projects you can write

How scopes are checked

  • Reading anything needs read.
  • Writing needs the write scope for the thing you're changing. For example, changing a map needs maps:write, whatever other scopes the credential has.
  • Deleting needs delete as well as the write scope, with two exceptions. Removing a layer from a map doesn't need it, because the dataset itself isn't affected. Revoking a share link doesn't need it either: it removes a public URL rather than data, and revoking a link should never be harder than creating one.
  • Anything not covered by a scope is refused. A new part of the API can't be used with a credential until it has been assigned a scope, so nothing becomes available to agents by accident.
  • Listing share links needs share:write as well as read, because the listing includes live share tokens, and each token can be turned into a public URL.

Key presets

The form for creating a key offers these presets. A key with any other set of scopes has to be set up by whoever runs your deployment.

PresetScopes
Read only read
Full agent read datasets:write models:write maps:write jobs:write
Full agent + delete read datasets:write models:write maps:write jobs:write delete

No key preset can publish a share link or switch projects. An API key works without anyone watching and lasts a long time, so publishing something at a public URL that anyone can open without signing in should be a decision someone makes explicitly. If a script needs to do it, your operator can create a key that includes that scope.

What a connector is granted

An OAuth connector asks for these scopes, and the approval screen describes each one in plain language before you accept:

Scope
read
datasets:write
models:write
maps:write
jobs:write
share:write
projects:write

delete isn't on the list, and mapbench doesn't give connected agents a delete tool. An agent can archive a dataset or a map, which you can undo, but it can't delete them.

Sharing and switching projects are on the list, and this is where connectors differ from keys. You see these permissions named on a screen before you approve them, and you can revoke the whole connection from your account page in one click. A key has neither of these.

Each credential works in one project

Projects divide up your organisation: each dataset, model and map belongs to one project. A credential is set to a single project and works only there. It doesn't follow the project you have open in the app.

  • You choose the project when you create a key. A connector starts in your default project.
  • You can move a credential to another project from your Account page at any time, without disconnecting and starting over.
  • A credential with projects:write can move itself, but only to a project you can write to. It never has more access than you.
  • A credential can't move content between projects. Moving a dataset or a map to another project is a manual step taken by a person, and it's recorded. A credential can change which project it works in, but the data stays where it is.
  • If you lose access to the credential's project, its requests fail with 403 no_project_access. It doesn't switch to another project. It isn't revoked automatically either, so its past activity stays linked to it.

Using a key

Send it as a bearer token:

curl -H "Authorization: Bearer tp_…" \
  https://mapbench.app/tilesets

Most people don't write these requests by hand. The same key works with the MCP server at https://mapbench.app/mcp, which is what Claude and other agents connect to. See Connect Claude to mapbench.

API keys can't be used on your account page, your organisation settings or the admin, whatever scopes they have. Credentials manage data. They can't manage credentials or membership.

Rate limits

  • 120 requests per minute per key.
  • 20 processing jobs per hour per key, in addition to your organisation's limit on queued jobs.

Both return 429 with a Retry-After header. Formats, limits and quotas lists the other limits.

Everything a credential does is recorded

Changes made through a key or a connector are recorded under that credential rather than as you. The activity history for a dataset or map shows which credential made each change, when, and whether a person or an agent made it. This is the reason to create a credential instead of sharing a login: with a shared password, every change looks as if the same person made it.

Revoking a credential ends its access immediately, and its history is kept.

See also