View Categories

Authentication

1 min read

Upbooks API Authentication #

JWT Token Authentication #

Upbooks APIs use JSON Web Tokens (JWT) for authentication. To obtain a bearer token, follow these steps:

  1. Make a POST request to the following endpoint:
POST https://api.upbooks.io/api/v1/auth/token/bearer
Content-Type: application/json
{"username": "your_username", "password": "your_password"}

The response will include a JWT bearer token, which you should store securely.

Include Token in API Requests #

Include the obtained JWT token in the Authorization header of your API requests, along with the Organization-ID and API-KEY headers:

Authorization: Bearer YOUR_JWT_TOKEN
Organization-ID: YOUR_ORGANIZATION_ID
API-KEY: YOUR_API_KEY

Sample cURL Request #

Here’s an example of how to make an authenticated API request using cURL:

curl -X GET https://api.upbooks.io/data-endpoint -H "Authorization: Bearer YOUR_JWT_TOKEN" -H "Organization-ID: YOUR_ORGANIZATION_ID" -H "API-KEY: YOUR_API_KEY"

Token Expiry #

JWT tokens have an expiration time. If your token expires, you will need to obtain a new one by re-authenticating with the token endpoint.

Token Security #

Keep your API tokens secure. Do not expose them in public repositories or insecure environments. Treat them like sensitive credentials to ensure the security of your Upbooks account.