HTTP API
Add archive restoration to your own site manager. Your backend can call the same tools as an MCP client using ordinary HTTP requests. No AI model is required.
Endpoint and access
POST https://app.reanimate.site/mcpSend JSON-RPC requests over MCP Streamable HTTP. For an unattended integration, a project owner or administrator opens Project settings → Partner integrations, creates a named key, selects permissions and copies the secret once. Store it on your backend. Send Authorization: Bearer YOUR_PROJECT_KEY to the endpoint above.
Call whoami and persist its projectId beside your workspace ID. A project contains multiple sites. Scoped credentials default source creation and listing to that project. Foreign site, job and version IDs are rejected. Use tools/list with the credential for its available tools.
Read is included with every key. Edit grants restoration, offline version copies and file editing. Publish grants hosting and domain changes. Editing an already live site also requires publish permission. Project keys use the current project owner’s account for worker attribution, usage and rate limits. Rotate or revoke a key from the same settings page. Rotation invalidates the old secret immediately and retains the key’s retry history.
For the sequence from domain input through editing and hosting, see the restore walkthrough.
Connect a customer
With the built-in issuer, request scope=mcp:project for a customer-selected project. The consent screen requires a selection, and refreshed tokens retain it. Requesting both scopes also requires a single project. Project roles are checked on calls. Existing broad connections keep their own access until revoked. For account-wide access use scope=mcp. External OAuth issuers keep their existing account flow. An MCP client with OAuth support can discover the issuer and manage the callback. For a custom backend, begin with the public resource metadata. Replace the callback below with a URL your application handles.
ORIGIN='https://app.reanimate.site'
RESOURCE="$ORIGIN/mcp"
curl -fsS "$ORIGIN/.well-known/oauth-protected-resource/mcp"- Read
resourceandauthorization_servers. Fetch the advertised issuer’s OAuth discovery document. On a dashboard using the built-in issuer it is/.well-known/oauth-authorization-server. Use its endpoint URLs for registration, authorization, token exchange and revocation. The examples below use the built-in issuer. - Register your application once at the registration endpoint. Save the returned
client_id. This example uses a public PKCE client. A confidential client can registerclient_secret_basicand authenticate at the token and revocation endpoints with its client ID and secret.
curl -fsS "$ORIGIN/oauth/mcp/register" \
-H 'Content-Type: application/json' \
-d '{"client_name":"Site Manager","redirect_uris":["https://your-app.example/oauth/callback"],"token_endpoint_auth_method":"none"}'- For each connection, generate a random
stateand PKCE verifier. Save both server-side with the initiating workspace and user. Compute the S256 challenge as the unpadded base64url encoding of the SHA-256 digest of the verifier. Open the authorization URL in the customer’s browser using URL-encoded parameters.
GET /oauth/mcp/authorize
response_type=code
client_id=<registered client_id>
redirect_uri=https://your-app.example/oauth/callback
scope=mcp:project
resource=https://app.reanimate.site/mcp
state=<random state>
code_challenge=<S256 challenge>
code_challenge_method=S256- After consent, verify the callback state and issuer against the stored request. Handle a denied grant before attempting an exchange. Exchange the one-use code with the original verifier and the exact registered redirect URI.
curl -fsS "$ORIGIN/oauth/mcp/token" \
--data-urlencode grant_type=authorization_code \
--data-urlencode "client_id=$CLIENT_ID" \
--data-urlencode "code=$CODE" \
--data-urlencode "code_verifier=$VERIFIER" \
--data-urlencode "redirect_uri=$REDIRECT_URI" \
--data-urlencode "resource=$RESOURCE"Store the returned access_token, refresh_token and expiry on your backend. Send the access token as a Bearer token to its MCP resource. Use whoami to identify the connected Reanimator account.
Make your first call
Set ACCESS_TOKEN to the project key or customer’s OAuth access token and RESOURCE to the MCP endpoint. This standalone request uses the supported 2026-07-28 stateless wire format. Each request declares its protocol version, client and capabilities. An MCP SDK can also negotiate the supported 2025-11-25 initialization flow.
curl -sS "$RESOURCE" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
-H 'Content-Type: application/json' \
-H 'Accept: application/json, text/event-stream' \
-H 'MCP-Protocol-Version: 2026-07-28' \
-H 'Mcp-Method: tools/call' \
-H 'Mcp-Name: whoami' \
-d '{
"jsonrpc":"2.0", "id":1, "method":"tools/call",
"params":{
"name":"whoami", "arguments":{},
"_meta":{
"io.modelcontextprotocol/protocolVersion":"2026-07-28",
"io.modelcontextprotocol/clientInfo":{"name":"site-manager","version":"1.0"},
"io.modelcontextprotocol/clientCapabilities":{}
}
}
}'A successful whoami returns a text content item whose JSON value contains userId. For other calls, change both Mcp-Name and params.name, then supply the tool’s arguments. For discovery, use tools/list as the method in the header and body, omit Mcp-Name, and send params containing the same _meta. Follow any nextCursor using params.cursor.
Send one JSON-RPC message per POST. Read JSON or server-sent events according to the response’s Content-Type. Match the JSON-RPC response ID, check for a top-level error, then check result.isError. Successful tools return JSON in result.content[0].text. A tool can also supply structuredContent. Tool error text is human-readable and can be plain text.
// After decoding the JSON-RPC response from JSON or an SSE data event
if (reply.error) throw new Error(reply.error.message);
const result = reply.result;
if (result.isError) throw new Error(result.content[0].text);
const data = result.structuredContent ?? JSON.parse(result.content[0].text);Refresh and disconnect
The built-in issuer issues one-hour access tokens. Each refresh rotates the refresh token within a fixed 30-day lifetime. Serialize refreshes for each connection and save the new pair together. Reuse of a spent token revokes its family. On invalid_grant, offer to reconnect.
curl -fsS "$ORIGIN/oauth/mcp/token" \
--data-urlencode grant_type=refresh_token \
--data-urlencode "client_id=$CLIENT_ID" \
--data-urlencode "refresh_token=$REFRESH_TOKEN" \
--data-urlencode "resource=$RESOURCE"
curl -fsS "$ORIGIN/oauth/mcp/revoke" \
--data-urlencode "client_id=$CLIENT_ID" \
--data-urlencode "token=$REFRESH_TOKEN"Use the current token when disconnecting, then remove your stored credentials. The customer can also revoke the client grant in MCP connections.
Retry a write
Generate one opaque idempotencyKey (1–128 characters) per user action and persist it before sending. Retry with the same credential identity, tool, project, key and arguments after a timeout. A different payload under the same key returns a tool error. A new key requests new work. The key belongs in params.arguments.
{"name":"create_restore_site","arguments":{"sourceUrl":"https://example.org","idempotencyKey":"workspace-42:create-17"}}Supported tools are create_restore_site, start_restore, publish_version,copy_version_to_site, deploy_subpage, deploy_subdomain and deploy_custom_domain. Account-wide OAuth must supply a project when creating a keyed source. Keyed version copies use a source and target in the same project. A replay returns the committed resource IDs and original acceptance state. Query the job or deployment for its current state. A keyed custom-domain deployment returns status: "accepted", siteId, deploymentId and publicPath; use list_deployments for subsequent routing or rollback. Receipts persist for the lifetime of the project.
Receive signed events
A project administrator registers one public HTTPS receiver in Project settings → Partner integrations and copies the signing secret. Replacing the receiver issues a new secret and drops outstanding deliveries for the previous subscription. The events are restore.completed, restore.failed and deployment.changed. Each POST contains a versioned JSON envelope and the project UUID. Restore data includes jobId, siteId and status. Deployment data includes deploymentId, siteId, versionId and status.
{
"version": 1, "id": "91419418-a990-47b4-87cc-8a12ed57fb9e",
"type": "restore.completed", "occurredAt": "2026-11-29T09:42:10.000Z",
"projectId": "ca51dfcd-2ef5-443f-94da-1da48964fa54",
"data": {"siteId":"27574367-5f44-4493-b12c-16e8a648f4fa",
"jobId":"e2b6ebfb-1186-4679-9e8d-73e42d71ce90","status":"succeeded"}
}Read the exact raw request bytes. Verify Reanimator-Signature against HMAC-SHA256 of the Unix-seconds Reanimator-Timestamp, a period, and those bytes, using the displayed secret as UTF-8. For example, in Node.js:
import { createHmac, timingSafeEqual } from "node:crypto";
function verify(secret, timestamp, signature, rawBody) {
if (!/^[0-9]{10}$/.test(timestamp) || Math.abs(Date.now()/1000 - Number(timestamp)) > 300) return false;
if (!/^v1=[0-9a-f]{64}$/.test(signature)) return false;
const mac = createHmac("sha256", secret).update(timestamp + ".").update(rawBody).digest();
return timingSafeEqual(mac, Buffer.from(signature.slice(3), "hex"));
}Check the project ID against your workspace mapping, deduplicate by event ID and return 2xx after durable acceptance. Delivery is asynchronous and can be duplicated or arrive out of order. Failed deliveries retry up to 12 total attempts, starting at 10 seconds and backing off to one hour. Query MCP for current state after downtime. Continue polling for live progress.
Errors, limits and retries
- 400 / 413 / 415. Check the JSON-RPC envelope, request size and content type. The MCP endpoint caps each request body at 10 MiB. OAuth registration accepts JSON. Token exchange and revocation accept form-encoded fields.
- 401. Check the
WWW-Authenticatechallenge, token expiry and resource URL. Attempt a refresh or start a new authorization. - 403. Use the dashboard’s canonical host. Browser clients also need an allowed origin. A backend request can omit
Origin. - 429 / 503. Respect
Retry-After. The user allowance is 120 MCP requests per minute across clients, with additional shared IP and service limits. Back off progress polling while a restore runs. - Tool error or lost response. Show the returned message. Use a persistent idempotency key for supported writes. For unkeyed operations inspect the resulting resource before retrying.
For a service readiness check, GET /api/health takes no credentials. HTTP 200 with ok: true means the service reached Supabase and the projects table. HTTP 503 indicates schema readiness issues and HTTP 500 indicates the check failed. To verify your connection and project access use whoami and get_project.