Authentication
How to authenticate your requests to Beatrice's API.
Authentication
All requests to Beatrice's API require a token passed as a query parameter.
Get your token
- Log in to your Beatrice dashboard.
- Go to API Settings.
- Copy your token.
Test Token (Public)
For testing and development, you can use our public demo token:
BEATRICE_API_TOKEN=dd2125a2-764e-427f-980f-31a6ffab0b04
This token provides access to a set of demo articles so you can test the integration immediately without creating an account or waiting for articles to be generated.
Note: This token is for testing purposes only and has limited access to demo content.
Using your token in requests
Add your token as a query parameter:
GET https://beatrice.app/api/articles?token=YOUR_TOKEN
JavaScript fetch example
const res = await fetch("https://beatrice.app/api/articles?token=YOUR_TOKEN");
const data = await res.json();
console.log(data);
Environment variables
Store your token securely in your .env.local
file:
BEATRICE_API_TOKEN=btc_1234567890abcdef
Then use it in your code:
const res = await fetch(
`https://beatrice.app/api/articles?token=${process.env.BEATRICE_API_TOKEN}`
);
Notes
- Passing the token as a query parameter works for your MVP. For production, migrating to an Authorization header is recommended for security.
- Never commit your actual API token to version control.
- Use environment variables to keep your token secure.
Errors
Status | Meaning |
---|---|
400 | Token required |
401 | Invalid token |
500 | Internal server error |
Demo
Want to see Beatrice in action? Check out our complete demo:
- Live Demo: demo.beatrice.app
- Source Code: github.com/BrissouLaChankla/demo-beatrice