Machine-readable API discovery
The canonical Safe4AI REST contract is OpenAPI 3.1. Every operation has a unique operationId, description, typed request fields, typed response schemas, and explicit authentication requirements for agent function calling.
Public sandbox
Use the deterministic sandbox immediately. It validates request/response plumbing and structured errors; it does not run customer data through an AI model.
Errors agents can act on
REST errors use JSON with a stable code, readable message, and concrete resolution hint. OAuth protocol endpoints retain their standard error and error_description fields and add remediation fields.
One request to an authenticated agent endpoint
Create an expiring sandbox key without signup, billing, or a sales form. The key is sandbox-only and cannot access customer or production systems.
Client-credentials flow for machine-to-machine agents
Safe4AI also exposes RFC-style dynamic sandbox client registration and OAuth 2.0 client_credentials. Registration is immediate. Access tokens are short-lived and sandbox-scoped.
client_credentials only, so it has no browser authorization endpoint.Typed callable operations
Agents can import /openapi.json and map operations directly into tools. Authenticated operations accept either OAuth or X-API-Key.
Markdown for agents
Safe4AI public pages support Markdown content negotiation. Send Accept: text/markdown; responses vary on Accept.
Safe4AI CLI
The official Safe4AI CLI package on npm is safe4ai-cli. It verifies agent-facing HTTP contracts and calls the public sandbox.
IETF RateLimit headers
Every Safe4AI sandbox API response includes IETF RateLimit-Policy / RateLimit fields plus compatibility X-RateLimit-Limit, X-RateLimit-Remaining, and X-RateLimit-Reset so agents can self-throttle. Default quota: 120 requests / 60 seconds per client IP. HTTP 429 responses include Retry-After. Agents can probe the contract with ?force_rate_limit=1.
API versioning and deprecation
The public sandbox API is versioned in the URL path (/api/v1/...). Breaking changes ship under a new major path. Deprecated operations advertise Deprecation: true and a Sunset HTTP-date at least 90 days before removal. Full policy: /developers/versioning. The unversioned /api/sandbox alias is deprecated in favor of /api/v1/sandbox.
Agent resource index
- /api — public JSON API directory.
- /openapi.json — OpenAPI 3.1 contract.
- /api/v1/keys — self-service sandbox API key endpoint.
- OAuth metadata — authorization server discovery.
- /llms.txt — Safe4AI product and developer context.
- /sitemap.xml — canonical public pages.
- Versioning policy — Sunset / Deprecation rules.
- Rate limits — IETF RateLimit header conventions.
Public sandbox vs. customer APIs
The endpoints documented here prove reachability, self-service onboarding, OAuth, schemas, error contracts, and function-calling compatibility without exposing customer systems. Production project credentials and business-specific APIs remain isolated per deployment.