Getting Started
Authentication
Authenticate with the Figma API using personal access tokens or OAuth 2.0.
The Figma REST API supports two authentication methods. Choose the one that fits your use case.
| Method | Best For | Header |
|---|---|---|
| Personal access token | Scripts, CI/CD, internal tools | X-Figma-Token: <token> |
| OAuth 2.0 | Third-party apps acting on behalf of users | Authorization: Bearer <token> |
Personal Access Tokens
Personal access tokens are the quickest way to authenticate. They are tied to your Figma account and grant the scopes you select at creation time.
Generate a token
Open Figma > Account Settings > Personal Access Tokens and click Create a new personal access token.
Give the token a descriptive name (for example, ci-design-token-sync) and choose an expiration period. Copy the token immediately -- Figma will not show it again.
Select scopes
When creating a token, select only the scopes your application needs. Using the minimum required scopes reduces the impact if a token is compromised.
| Scope | Access granted |
|-------|---------------|
| file_content:read | Read file data, nodes, and export images |
| file_content:write | Write to files (variables, components) |
| file_comments:write | Create, edit, and delete comments |
| webhooks:write | Create and manage webhook subscriptions |
| file_dev_resources:read | Read dev resources from files |
| file_dev_resources:write | Write dev resources to files |
Use the token in requests
Include the token in the X-Figma-Token header on every request.
Verify your token
The simplest way to confirm your token is valid is to call the /v1/me endpoint. A 200 response with your user profile means authentication is working.
If you receive a 403 Forbidden response, the token is invalid, expired, or lacks the required scope for the endpoint you are calling.
OAuth 2.0
OAuth 2.0 is required when your application acts on behalf of other Figma users. Figma implements the authorization code grant flow.
Register your application
Go to the Figma Developer Portal and create a new application. You will receive a client ID and client secret.
Configure your redirect URI -- this is where Figma sends users after they authorize your app.
Redirect the user to Figma
Send users to the Figma authorization URL to request access. Include the scopes your application needs.
| Parameter | Required | Description |
|-----------|----------|-------------|
| client_id | Yes | Your application's client ID |
| redirect_uri | Yes | Must match a registered redirect URI |
| scope | Yes | Space-separated list of scopes |
| state | Yes | A random string to prevent CSRF attacks |
| response_type | Yes | Must be code |
Available OAuth scopes:
| Scope | Access granted |
|-------|---------------|
| files:read | Read files, nodes, images, components, styles |
| file_comments:write | Create, edit, and delete comments |
| webhooks:write | Create and manage webhooks |
| file_variables:read | Read variables and variable collections |
| file_variables:write | Create and update variables |
Exchange the authorization code
After the user authorizes your app, Figma redirects to your redirect_uri with a code query parameter. Exchange the code for an access token.
The response includes:
| Field | Type | Description |
|-------|------|-------------|
| access_token | string | The token to use in API requests |
| refresh_token | string | Used to obtain a new access token when the current one expires |
| expires_in | number | Token lifetime in seconds (typically 14400 = 4 hours) |
Use the access token
With OAuth, use the standard Authorization: Bearer header instead of X-Figma-Token.
Refresh expired tokens
Access tokens expire after the duration specified in expires_in. Use the refresh token to obtain a new access token without requiring the user to re-authorize.
The response contains a new access_token and refresh_token. Store the new refresh token -- each refresh token is single-use.
Implement token refresh proactively. Check the expires_in value and refresh the token before it expires, rather than waiting for a 403 error.
Token Security Best Practices
| Practice | Recommendation |
|---|---|
| Storage | Use environment variables or a secret manager (Vault, AWS Secrets Manager) |
| Rotation | Set expiration on personal access tokens and rotate regularly |
| Scope | Request only the minimum permissions your application needs |
| Transport | Always use HTTPS — the API rejects HTTP requests |
| Logging | Never log tokens in plaintext; mask them in error output |
| Client-side apps | Proxy API calls through your backend; never embed tokens in frontend code |