Back to all questions

How do I authenticate with the API?

API Usage
api
authentication
jwt
token

Most read-only endpoints work without authentication (guest access). For higher rate limits and builder tools, you need a JWT token.

Getting a Token

  1. Create an account at matcraft.ai (Google, GitHub, or ORCID sign-in)
  2. Go to Settings > API Keys
  3. Click "Generate New Token"
  4. Copy the token immediately (shown only once)

Using the Token

Include it in the Authorization header:

bash
curl -H "Authorization: Bearer YOUR_TOKEN" "https://api.matcraft.ai/api/v1/materials"

Or with the Python SDK:

python
from matcraft import MatCraftClient
client = MatCraftClient(token="YOUR_TOKEN")

Tokens expire after 30 days by default. Use the refresh endpoint to get a new token before expiry.

Related Questions