API Authentication
This article introduces the authentication methods for using the MaiAgent API and how to obtain them
Last updated
Was this helpful?
This article introduces the authentication methods for using the MaiAgent API and how to obtain them
MaiAgent uses API keys for authentication.
All API requests must include an API Key in the HTTP Header, in the following format:
const headers = {
"Authorization": "Api-Key YOUR_API_KEY_HERE",
"Content-Type": "application/json"
}Please log in to the MaiAgent system backend and follow these steps:
Click the "Username" dropdown menu in the upper right corner.
Click "Account" to go to the profile page.


Switch the page to the API Key page.

You can then copy and view the "API Key".

Security Reminder: Please keep your API key secure and do not share it in public places.
Key Format Description: The API key is a combination of alphanumeric characters.
When authentication fails, the API will return a 401 Unauthorized HTTP error code:
Invalid or Missing API Key
Fix suggestion: Check if the request header contains the correct Authorization field. The format should be: Authorization: Api-Key YOUR_API_KEY
Incorrect API Key Format
Fix suggestion: Confirm that the API Key format is correct. Check if the correct prefix Api-Key is used instead of Bearer, and ensure the API Key itself does not have extra spaces or characters.
Last updated
Was this helpful?
Was this helpful?
{
"detail": "Authentication credentials were not provided."
}{
"detail": "Invalid API key format."
}