Skip to navigation

Management API

Administer your org programmatically: API keys, projects, routing policies, credentials, settings, and usage

The Management API administers your organization’s API keys, projects, routing policies, provider credentials, export destinations, settings, security rules, and usage from code, such as Pulumi, Terraform, or one-off scripts. The endpoint reference in this section has the full schemas.

Base URL and authentication

https://api-gateway.merge.dev

Authenticate with a management key from API keys → Management keys in the dashboard, shown once. It acts only on its own organization and can’t call model endpoints.

Authorization: Bearer mgmt_...

Scopes

A management key’s scopes are dashboard permission names. A new key gets the permissions its creator holds, so it can do through the API what that person can do in the dashboard. A call without the scope it needs returns 403. A key keeps the scopes it was minted with, so mint a new one to pick up permissions granted later.

AreaEndpointsWrites needReads also accept
API keys/v1/keysmanage_api_keysview_api_keys, view_billing
Projects/v1/projects, /controls, /modelsmanage_projects
Routing policies/v1/routing-policiesmanage_routingAny active mg_ API key of the organization, except in Merge for Workforce organizations
Credentials/v1/credentialsmanage_credentialsview_credentials
Export destinations/v1/export-destinationsmanage_telemetry_exportview_telemetry_export
Organization/v1/organizationmanage_org_settingsview_org_settings
Security rules/v1/dlp-rules, /v1/blocklist-rulesmanage_org_settingsview_org_settings
Security rules/v1/organization/pi-settingsmanage_security_rulesview_security_rules
Security rules/v1/projects/{project_id}/pi-settings, /dlp-settingsmanage_security_rules or manage_projectsview_security_rules
Usage/v1/organization/usageview_billing
Usage/v1/projects/{project_id}/usageview_billing, manage_projects
Lookups/v1/organization/models, /v1/organization/vendors, /v1/model-aliasesview_routing, manage_routing
Lookups/v1/guardrailsview_security_rules, manage_security_rules
Lookups/v1/creditsview_billing, manage_billing
Lookups/v1/membersview_users, manage_users

Keys minted before scopes became permission names hold manage_keys and read_usage, which work as manage_api_keys and view_billing.

Walkthroughs: Management API keys and Projects API. Creating an API key needs a payment method on file, except on the Free plan. There’s no rotate endpoint: create the new key, then delete or disable the old one.

Errors

An error response has a detail field. It’s either a string or an object with a code to branch on and a message; some objects add fields, such as count.

{"detail": {"code": "payment_method_required", "message": "Add a payment method before creating API keys."}}

A request body or query that fails validation returns 422 with detail as a list, one entry per problem, each with loc (where), msg, and type. A missing or invalid key returns 401. See the codes worth branching on.

Next steps