Authentication with the Yandex Vision OCR API
Get your account data for authentication:
-
Get an IAM token for your Yandex account or federated account.
-
Get the ID of the folder for which your account has the
ai.vision.user
role or higher. -
When accessing Vision OCR via the API, provide the received parameters in each request:
-
For the Vision API and Classifier API:
Specify the IAM token in the
Authorization
header as follows:Authorization: Bearer <IAM_token>
Specify the folder ID in the request body in the
folderId
parameter. -
For the OCR API:
- Specify the IAM token in the
Authorization
header. - Specify the folder ID in the
x-folder-id
header.
Authorization: Bearer <IAM_token> x-folder-id <folder_ID>
- Specify the IAM token in the
-
Vision OCR supports two authentication methods based on service accounts:
-
With an IAM token:
-
Get an IAM token.
-
Provide the IAM token in the
Authorization
header in the following format:Authorization: Bearer <IAM_token>
-
-
With API keys.
Use API keys if requesting an IAM token automatically is not an option.
-
Provide the API key in the
Authorization
header in the following format:Authorization: Api-Key <API key>
Do not specify the folder ID in your requests, as the service uses the folder the service account was created in.