QIMA Logo

Authentication Introduction

Latest Update Time: 2026-07-02 00:00:00

Authentication is the first step to using QIMA Public APIs — every endpoint is protected and requires a valid access token. This module provides APIs for getting, refreshing, and revoking that token.

This page documents the shared setup used by every Authentication guide. Each API-specific guide links back here for authentication, headers, and environment details.

Base URL

All Authentication APIs are served from the QIMA Public API host for your environment:

https://ppapi.qima.com

For production integrations, replace the host with the QIMA API host provided for your environment.

Required Headers

You need a QIMA customer account and an Ai-Api-Access-Token for the target environment, provided by QIMA. The Get Token API (see the Getting Started Guide) only needs Ai-Api-Access-Token and Referer, since you don't have a user session yet. Refresh Token and Revoke Token need the full set below, since they act on an existing session.

Header / ParameterLocationSourceDescription
Ai-Api-Access-TokenRequest header (all Authentication APIs)Provided by QIMARequest source identifier. Each client may have a different value per environment.
AuthorizationRequest header (Refresh Token, Revoke Token)Get Token API response content.token.tokenFormat: Bearer <access-token>. The access token to refresh or revoke.
RefererRequest header (all Authentication APIs)Fixed valuehttps://preprodmy.qima.com/
Ai-Api-Refresh-KeyRequest header (Refresh Token, Revoke Token)Get Token / Refresh Token API response content.refreshKeyThe refresh key associated with the token being refreshed or revoked.

Common Authentication Errors

These errors apply across Authentication APIs:

StatusMeaningRecommended Action
401 UnauthorizedCredentials, token, or refresh key are invalid or don't match.Re-check the account/password (Get Token) or Authorization/Ai-Api-Refresh-Key (Refresh/Revoke Token).
403 ForbiddenAi-Api-Access-Token is missing, invalid, or not valid for the requested user type.Confirm the token was issued for the correct environment and user type.

Each API guide includes additional operation-specific error codes.

Available APIs

APIMethodEndpointGuideAPI Reference
Get tokenPOST/auth/v2/tokenGetting Started GuideAPI Reference
Refresh tokenPUT/auth/v2/tokenRefresh Token GuideAPI Reference
Revoke tokenDELETE/auth/v2/tokenRevoke Token GuideAPI Reference

Integration Workflow

Yes

Done with session

1. POST /auth/v2/token
account, password, userType

Store token, refreshKey,
validBefore from content.token

Token nearing expiry?

2. PUT /auth/v2/token
Authorization + Ai-Api-Refresh-Key

Store new token, refreshKey

3. DELETE /auth/v2/token
Authorization + Ai-Api-Refresh-Key

StepGuide
Get tokenGetting Started Guide
Refresh token before it expiresRefresh Token Guide
Revoke token when doneRevoke Token Guide

validBefore in the Get Token / Refresh Token response is a Unix timestamp (seconds) — refresh the token before this time to avoid 401/403 errors on subsequent calls.

Choosing the Right API

Your goalRecommended APIs
Authenticate for the first timeGet Token
Extend a session without asking the user to log in againRefresh Token
Log out / invalidate a token immediatelyRevoke Token