Skip to main content
Firecrawl runs an OAuth 2.1 authorization server. Your app sends the user to Firecrawl, the user signs in and picks a team, and your app gets an access token it can use on the Firecrawl REST API in place of an API key. Usage is billed to the team the user picked. Each connection gets its own API key, created by Firecrawl and never shown to your app. The user can see and revoke the connection under Connected apps in Settings, and deleting another key in the dashboard doesn’t affect it.
If your platform creates Firecrawl accounts for its users and pays for their usage, use Firecrawl for Platforms instead. OAuth is for users who bring their own Firecrawl account. To compare OAuth with API keys and MCP sign-in, see Authentication.

Overview

Scopes

A token can do anything an API key on that team can do. Request only what you need and keep tokens on your server.

Register your app

Your app needs a client_id. There are two ways to get one, and neither needs approval from Firecrawl.
Register once with RFC 7591 and store the client_id it returns.
The client_name is what users see on the consent screen.
Redirect URIs must use HTTPS. http://localhost and other loopback addresses are allowed for local development. A redirect URI may not contain a fragment or user info, and the URI you send at authorization must match a registered one exactly.

Authorize

Generate a PKCE code_verifier and its S256 code_challenge, then send the user’s browser to the authorization endpoint.
The user signs in if needed, chooses a team, and approves. Firecrawl then redirects to your redirect_uri with code and state. The code is valid for a short time and only once. If the user cancels, Firecrawl redirects with error=access_denied.

Exchange the code

The token endpoint accepts application/x-www-form-urlencoded or JSON.
user_id and team_id identify who authorized and which team is billed. Store both tokens server-side.

Call the API

Send the access token as a bearer token, exactly like an API key.
The SDKs accept the token wherever they take an API key, for example new Firecrawl({ apiKey: "fco_..." }).

Refresh

Access tokens expire after one hour. Exchange the refresh token for a new pair before or after expiry.
The response has the same shape as the code exchange. Refresh tokens rotate: each one works once, so always store the new refresh_token from the response. Using a refresh token a second time is treated as a stolen token: Firecrawl revokes the whole connection, including the tokens the first refresh just returned, and the user has to connect your app again. Serialize refreshes per connection and never retry a refresh that returned invalid_grant.

Revoke

Call the revocation endpoint (RFC 7009) when the user disconnects Firecrawl in your app. Send the refresh token: that revokes the whole connection, including its access token and the key behind it. Sending an access token only invalidates that access token; the refresh token keeps working and the connection stays listed in the user’s Settings.
The endpoint returns 200 even when the token is unknown or already revoked. Users can also revoke your app under Connected apps in Settings. A connection also ends when the authorizing user leaves the team.

Errors

The authorization and token endpoints return standard OAuth errors as JSON: {"error": "...", "error_description": "..."}. On the REST API, an OAuth token that is expired, revoked, or unknown gets 401 with Unauthorized: Invalid or expired OAuth token. Refresh once, and if that fails with invalid_grant, ask the user to reconnect. A 503 with OAuth authentication is temporarily unavailable is temporary; retry with backoff. Other errors, such as 402 for insufficient credits, are the same as with an API key.