flamel
DOCS

API Reference

Flamel's REST API and MCP server — authenticate with OAuth 2.1, explore endpoints, and integrate Flamel data into your tools.

REST API access

The MCP server below is open to every Flamel user: sign in with your Flamel account. The REST API is currently available to staff and select partners. Contact your account manager or email support@flamel.ai to request REST access. Hub admins who only need to read their own hub's opt-ins and spend can create a key themselves with the Hub API.

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.

EndpointURL
Authorizationhttps://studio.flamel.ai/api/oauth/authorize
Tokenhttps://studio.flamel.ai/api/oauth/token
Client registrationhttps://studio.flamel.ai/api/oauth/register
Token revocationhttps://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).

bash
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.

code
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:

bash
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:

json
{  "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, so you sign in with your Flamel account and the client discovers the available tools automatically. Each tool runs with your own role and solution permissions in the hub or workspace you choose.

Connect your AI client

The fastest path is the Flamel MCP page at studio.flamel.ai/mcp/docs. It shows the server URL with a copy button, setup steps for each client, and the skills your access allows.

Open Settings, then Connectors, then Add custom connector. Paste the server URL and sign in to Flamel.

A ChatGPT workspace admin turns on developer mode, adds the server URL as a custom app, and signs in to Flamel.

Open Settings, then MCP, then Add new MCP server, or add this to ~/.cursor/mcp.json. Sign in when Cursor asks.

{ "mcpServers": { "flamel": { "url": "https://studio.flamel.ai/api/mcp" } } }

Run this command, then finish sign-in with /mcp.

claude mcp add --transport http flamel https://studio.flamel.ai/api/mcp

Any agent harness that supports remote MCP servers with OAuth, such as Scout, connects the same way. Add the server URL as a remote MCP server and complete the Flamel sign-in when the harness opens it.

After you connect, ask your client to use the connect-flamel skill. It confirms who you are signed in as, which hub or workspace is active, and which skills you can use.

Get your skills

Skills are step-by-step instructions that teach your AI client how to do a Flamel task well. Your client can load them through the query_flamel_skills tool, or you can install them yourself.

Open the Flamel MCP page

Sign in to Studio and go to studio.flamel.ai/mcp/docs.

Pick your hub or workspace

Use the switcher to choose the hub or workspace you want the client to work in. The skill list and downloads match what you can do in the hub or workspace you have selected.

Download a skill

Click Download on a skill to get it as a zip. Upload the zip to Claude as a skill, which an organization owner can do once for everyone, or unzip it into ~/.claude/skills/ for Claude Code.

You see a skill only when your account can use every tool it needs. Paid skills require the matching solution on your account, such as Paid Ads, Paid Analytics, Google Ads, or ChatGPT Ads. If a skill you expect is missing, ask a hub admin to grant the solution.

SkillWhat it does
connect-flamelConfirms your connection, active scope, and the skills you can use.
paid-performance-reportReports paid spend, CPC, CPM, CTR, and leads by workspace and playbook for a date range.
weekly-reportBuilds a cross-channel performance report for a date range and audience you choose.
chatgpt-ads-reportShows how ChatGPT Ads are set up and performing, including spend, results, and workspace readiness.
playbook-healthFinds playbooks and opt-ins that are failing, stuck, or not launching, and ranks the fixes.
build-playbookDrafts a full Meta or Google Ads playbook with campaigns, creative, targeting, and budget from a brief.
opt-in-playbookLocalizes a hub playbook for a workspace and opts it in, or changes or cancels an opt-in.
create-command-centerCreates a paid Command Center or alert rules for chosen workspaces and campaigns.
manage-command-centerReviews and adjusts campaign status, pacing, budgets, and alerts in a Command Center.
analyze-and-tuneDiagnoses paid and cross-channel performance and previews evidence-backed changes.
configure-meta-adsAudits and completes a workspace's Meta Ads setup, defaults, URLs, audiences, and lead forms.
configure-google-adsAudits and completes a workspace's Google Ads connection, defaults, attribution, URLs, and targeting.
triage-signalsWorks through open items on the Signals page, from what needs attention to the fix.

How changes are approved

Every change starts as a preview that changes no campaign, budget, or setting. Flamel applies it only after you give an explicit yes to that exact preview, and anything that adds or raises ad spend shows the dollar amounts first. A read-only connection can preview changes but cannot apply them.

REST endpoints

The REST API shares the same bearer token. Base URL:

https://studio.flamel.ai/api

Hubs and workspaces

MethodPathDescription
GET/workspacesList all workspaces in your hub
GET/workspaces/:idGet details for a specific workspace
GET/hubsList all hubs in your account

Content

MethodPathDescription
GET/postsList scheduled and published posts
POST/postsCreate a new post
GET/mediaList media library assets
POST/mediaUpload a media asset

Analytics

MethodPathDescription
GET/analytics/organicRetrieve organic post performance
GET/analytics/paidRetrieve paid campaign performance
GET/analytics/google-reviewsRetrieve 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

PlanRequests per minute
Standard60
Partner300

Requests exceeding the limit receive 429 Too Many Requests with a Retry-After header.

Error codes

CodeMeaning
400Bad Request: check your request body or query parameters
401Unauthorized: token missing, expired, or invalid
403Forbidden: token lacks the required scope
404Not Found: resource does not exist or is inaccessible
429Rate Limited: retry after the indicated delay
500Server Error: contact support if this persists