How to set up API integrations on Linear
Setting up API integrations on Linear involves creating an API key in your workspace settings, configuring the appropriate scopes, and implementing the Linear GraphQL API in your application. You can create personal API keys for individual use or OAuth applications for team-wide integrations.
Prerequisites
- Linear workspace admin access
- Basic understanding of APIs
- Development environment for testing
- Application or service to integrate with Linear
Step-by-Step Instructions
Access Linear Settings
Create a Personal API Key
Configure API Key Scopes
- read - View issues, projects, and other data
- write - Create and update issues, comments, and labels
- admin - Full workspace access including settings
Copy and Secure Your API Key
Set Up Your Development Environment
npm install @linear/sdkFor other languages, prepare your HTTP client to make requests to https://api.linear.app/graphql.Initialize the Linear Client
import { LinearClient } from '@linear/sdk';
const linearClient = new LinearClient({
apiKey: process.env.LINEAR_API_KEY
});For direct GraphQL requests, include the API key in the Authorization header as Bearer YOUR_API_KEY.Test Your Integration
const me = await linearClient.viewer;
console.log(`Connected as: ${me.name}`);If successful, you should see your user details returned from the Linear API.Configure Webhooks (Optional)
Common Issues & Troubleshooting
API key authentication fails with 401 Unauthorized error
Verify your API key is correctly set in your environment variables and that you're including it in the Authorization: Bearer YOUR_API_KEY header. Check that the API key hasn't expired.
GraphQL queries return permission denied errors
Review your API key scopes in Linear settings. Ensure your key has the necessary permissions (read, write, or admin) for the operations you're trying to perform.
Webhook events are not being received
Check that your webhook endpoint is publicly accessible and returns a 200 status code. Verify the webhook URL is correct in Linear settings and that your server is properly handling POST requests.
Rate limiting errors when making API calls
Implement exponential backoff and respect Linear's rate limits. The API allows up to 2000 requests per hour per API key. Add delays between requests and handle 429 status codes gracefully.