API Reference
Flamel's REST API and MCP server — authenticate with OAuth 2.1, explore endpoints, and integrate Flamel data into your tools.
Staff-gated access
API access is currently available to staff and select partners. Contact your account manager or email support@flamel.ai to request access.
Flamel exposes a REST API and an MCP server so you can integrate Flamel data and actions into your own tools, dashboards, and AI agents. Both share the same OAuth 2.1 authentication.
Authentication
Flamel uses OAuth 2.1 with the authorization code flow and PKCE. Tokens are issued per user and carry the flamel:full scope. The endpoints below are discoverable at https://studio.flamel.ai/.well-known/oauth-authorization-server.
| Endpoint | URL |
|---|---|
| Authorization | https://studio.flamel.ai/api/oauth/authorize |
| Token | https://studio.flamel.ai/api/oauth/token |
| Client registration | https://studio.flamel.ai/api/oauth/register |
| Token revocation | https://studio.flamel.ai/api/oauth/revoke |
Supported grant types are authorization_code and refresh_token. The only code_challenge_method is S256, and the only scope is flamel:full.
Register a client
If your account manager has not pre-provisioned a client, register one with dynamic client registration. You receive back a client_id (and a client_secret if you request a confidential client).
curl -X POST https://studio.flamel.ai/api/oauth/register \
-H "Content-Type: application/json" \
-d '{
"client_name": "My Integration",
"redirect_uris": ["https://your-app.example.com/callback"],
"token_endpoint_auth_method": "client_secret_post"
}'
For a public (PKCE-only) client, send "token_endpoint_auth_method": "none" and omit the secret on token exchange.
Send the user through authorization
Generate a PKCE code_verifier and its code_challenge (S256), then redirect the user to the authorization endpoint. After they approve the consent screen, Flamel redirects back to your redirect_uri with a code query parameter.
https://studio.flamel.ai/api/oauth/authorize
?response_type=code
&client_id=<your_client_id>
&redirect_uri=https://your-app.example.com/callback
&code_challenge=<your_code_challenge>
&code_challenge_method=S256
&scope=flamel:full
Exchange the code for a bearer token
Post the authorization code and your PKCE code_verifier to the token endpoint:
curl -X POST https://studio.flamel.ai/api/oauth/token \
-H "Content-Type: application/x-www-form-urlencoded" \
-d "grant_type=authorization_code" \
-d "code=<authorization_code>" \
-d "redirect_uri=https://your-app.example.com/callback" \
-d "client_id=<your_client_id>" \
-d "client_secret=<your_client_secret>" \
-d "code_verifier=<your_code_verifier>"
The response contains your access_token. Include it in the Authorization header of every request:
Authorization: Bearer <your_access_token>
When the access token expires, request a new one with grant_type=refresh_token and the refresh_token from this response.
Confirm authentication
Use the MCP server's whoami tool (see below) to confirm your token works. It returns your authenticated user, active workspace, active hub, scope, and client ID:
{
"user": { "_id": "...", "email": "you@example.com", "firstname": "...", "lastname": "..." },
"workspace": { "_id": "...", "name": "Downtown Location" },
"hub": { "_id": "...", "name": "Acme Franchising" },
"scope": "flamel:full",
"clientId": "<your_client_id>"
}
MCP server
The MCP server at https://studio.flamel.ai/api/mcp is the primary integration surface for AI agents. It uses the same OAuth flow as above and exposes Flamel actions as natural-language tool calls. Available tool groups: Docs, Organic, Paid, Media, plus the whoami convenience tool.
Point any MCP client (Claude, an agent framework, or your own) at the MCP URL and complete the OAuth flow; the client discovers the available tools automatically.
REST endpoints
The REST API shares the same bearer token. Base URL:
https://studio.flamel.ai/api
Hubs and workspaces
| Method | Path | Description |
|---|---|---|
| GET | /workspaces | List all workspaces in your hub |
| GET | /workspaces/:id | Get details for a specific workspace |
| GET | /hubs | List all hubs in your account |
Content
| Method | Path | Description |
|---|---|---|
| GET | /posts | List scheduled and published posts |
| POST | /posts | Create a new post |
| GET | /media | List media library assets |
| POST | /media | Upload a media asset |
Analytics
| Method | Path | Description |
|---|---|---|
| GET | /analytics/organic | Retrieve organic post performance |
| GET | /analytics/paid | Retrieve paid campaign performance |
| GET | /analytics/google-reviews | Retrieve Google Review summaries |
Request bodies and field-level schemas
The write endpoints (POST /posts, POST /media) accept the same payloads the in-app composer and uploader send. Because those shapes evolve with the product, contact support@flamel.ai for the current field-level schema for any write endpoint rather than relying on a fixed copy here.
Rate limits
| Plan | Requests per minute |
|---|---|
| Standard | 60 |
| Partner | 300 |
Requests exceeding the limit receive 429 Too Many Requests with a Retry-After header.
Error codes
| Code | Meaning |
|---|---|
| 400 | Bad Request — check your request body or query parameters |
| 401 | Unauthorized — token missing, expired, or invalid |
| 403 | Forbidden — token lacks the required scope |
| 404 | Not Found — resource does not exist or is inaccessible |
| 429 | Rate Limited — retry after the indicated delay |
| 500 | Server Error — contact support if this persists |