Skip to main content

Authentication

The Gesvision API uses JWT (JSON Web Tokens) for authentication. Every API request must include a valid token in the Authorization header.

Obtaining a token​

Send a POST request to the authentication endpoint with your Gesvision credentials:

curl -X POST https://app.gesvision.com/Gesvision/rest/api/auth/login \
-H "Content-Type: application/json" \
-d '{
"username": "your_api_user",
"password": "your_api_password"
}'

A successful response returns the JWT token and its expiration:

{
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"expiresIn": 86400
}
FieldTypeDescription
tokenstringThe JWT token to use in subsequent requests
expiresInintegerToken lifetime in seconds (typically 24 hours)

Using the token​

Include the token in every API request as a Bearer token:

curl https://app.gesvision.com/Gesvision/rest/api/v1/invoices \
-H "Authorization: Bearer eyJhbGciOiJIUzI1NiIs..."

Token expiration and renewal​

  • Tokens expire after the period indicated by expiresIn (in seconds)
  • When a token expires, the API returns 401 Unauthorized
  • Simply request a new token by calling the login endpoint again
  • There is no refresh token mechanism — re-authenticate with your credentials

Permissions​

The API respects the same permission model as the Gesvision web application. Your API user inherits the roles and access rights configured in Gesvision Administration → Users & Roles.

PermissionWhat it controls
Read invoicesGET /api/v1/invoices and GET /api/v1/invoices/{id}
Write invoicesPOST, PUT, DELETE on invoices
Read ordersGET /api/v1/orders
Write ordersPOST, PUT, DELETE on orders
PaymentsPOST /api/v1/payments
CustomersGET and PUT on customers

Security best practices​

  • Never expose tokens in URLs, query parameters, or client-side code
  • Store tokens in environment variables or a secrets manager
  • Use a dedicated API user — do not share your personal Gesvision login
  • Rotate credentials periodically
  • The API enforces HTTPS — plain HTTP connections are rejected
  • Tokens are signed with HMAC-SHA256 and cannot be forged or modified