Authentication
Authenticate with an API key for your application or with OAuth user tokens for the users of your product.
Copilot via API supports two authentication methods. Your Haufe contact person sets up the method that fits your use case. The header you send depends on the method.
| Method | Use it when | Header |
|---|---|---|
| API key | Your application calls the API in its own name. You use one key for your application. | api-key: <API_KEY> |
| OAuth user token | Haufe users log in through your product and use their own content package. | Authorization: Bearer <ACCESS_TOKEN> |
Send exactly one of the two headers with every request.
Use the OAuth user login when the person who uses your product has their own Haufe account and license. Use the API key when they do not.
API Key
How to Get Your API Key
Your API key is provided by your Haufe contact person. You can view and rotate it in the Developer Portal.
Using Your API Key
Include your API key in the api-key header of every request:
curl --request GET \
--url https://api.haufe.ai/agents/v1/assistants \
--header 'api-key: <API_KEY>'OAuth User Login
Your users log in with their Haufe account through your product. Your backend exchanges the login for an access token and sends it as a bearer token:
curl --request GET \
--url https://api.haufe.ai/agents/v1/assistants \
--header 'Authorization: Bearer <ACCESS_TOKEN>'The guide OAuth: Let Your Users Log In with Haufe describes how you get your client credentials and how you run the login flow. It also lists the errors to expect.