A request like this:
curl -XGET -H 'Authorization: Bearer HERE_GOES_YOUR_JWT' https://ean-db.com/api/v2/account
returns a response with 200 response code and an AccountResponse
object.
{
"account": {
"primaryEmail": "your@email.com", // Your email
"balance": 49973 // Your current balance (remaining requests), integer
}
}
curl -XPUT -H 'Authorization: Bearer HERE_GOES_YOUR_JWT' https://ean-db.com/api/v2/account/jwt
This request generates an additional JWT, associated with your account. The new JWT is returned in the response:
{
"jwt": "HERE_GOES_YOUR_NEW_JWT"
}
Every account is allowed to have a maximum of 3 JWTs. If you attempt to create more, the request will fail with 409 error:
{
"error": {
"code": 409,
"description": "JWT limit exceeded, please revoke an existing JWT to create a new one"
}
}
This endpoint allows you to revoke one of the existing JWTs in your account:
curl -XDELETE -H 'Authorization: Bearer HERE_GOES_YOUR_JWT' -H 'Content-Type: application/json' \
--data '{"jwt": "JWT_TO_REVOKE"}' \
https://ean-db.com/api/v2/account/jwt
Request body should contain the JWT that you wish to revoke in a json object: {"jwt": "JWT_TO_REVOKE"}
. Content-Type: application/json
header should also be added to the request.
In case of the successful revokation, 204 response code is returned with no content.
You can get 403 response for a couple of reasons:
Authorization
header containing your JWT is missing, malformed or invalid.
In this case you’ll see a message JWT is missing or invalid, check Authorization header
in the description
field of the error response. You could check the tutorial for more information on how get JWT and pass it correctly.
Your JWT was revoked (look for JWT revoked
message in the description
field).
You can revoke your current JWT (and effectively deny access to anyone who tries to use it) in your account area. This error is what you’ll see if you make an API request using one of the revoked JWTs.
Your JWT is expired (look for JWT expired
message in the description
field).
JWT expires after one year since it was generated. If you get this error, you need to generate new JWT in your account area and replace the old one with freshly generated JWT.
{
"error": {
"code": 403,
"description": "Your JWT is expired" // Or one of the other error messages
}
}