Hi. I’ve tried to use the API for retrieving the openapi spec for a given project, using an access token. However, I can’t seem to get it working properly. I get an message that the token is invalid. I pass it along like the documentation tells me “Authorization: Bearer {{token}}”, but I noticed that the generated token had this prefix “APS-”. I then tried to remove the prefix, upon which I receive this message: “No project maintainer privilege”. Is this due to the fact that EU is separate and needs a different url? I’ve tried it through the web interface on Export Data in OpenAPI/Swagger Format - Apidog API What am I missing or doing wrong?
Anyone?
Hi @naLu,
You don’t need to remove any part of the API token - just use the entire token (including the “APS-” prefix) as it’s generated.
For reference on how to obtain the access token, check this doc: Authentication - Apidog API
I see, but when I use the full token, it tells me the API token is invalid. We’ve tried 3 different generated tokens from different employee accounts
Hi @naLu,
To export the OpenAPI spec successfully:
- Ensure the project ID is correct and you have export permissions for it.
- Use the full token (including “APS-” prefix) in the
Authorization: Bearer {{token}}
header. - Include the
X-Apidog-Api-Version
header (e.g.,2024-03-28
).
Let me know if the issue persists.
Hi,
Thank you for your responses so far.
I’ve double-checked and verified all the relevant steps to ensure everything is configured correctly:
The API Access Token was generated by an account with the Team Owner role. The token includes the APS- prefix and is added to the request header as follows:
Authorization: Bearer APS-...
According to the API Reference, the only supported value for the X-Apidog-Api-Version header is 2024-03-28, which I have included like this:
X-Apidog-Api-Version: 2024-03-28
I’ve also confirmed that I copied the correct Project ID.
To test this, I’ve used both the ApiDog desktop application and the web interface at:
However, the only response I receive is:
{
"success": false,
"errorCode": "401005",
"errorMessage": "The token is invalid"
}
If this issue is related to insufficient permissions, I would have expected a different error message. If that’s the case, could you please clarify how to correctly assign the necessary permissions to a user so they can generate a valid access token?
Looking forward to your guidance, and thank you in advance for your support.
I got contacted by Zoey via a private message. If this is not correct, please let me know