> For the complete documentation index, see [llms.txt](https://docs.facephi.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.facephi.com/docs.facephi-en/sdks/backend-sdk/selphid/technical_documentation/api_reference/onboarding/api-v1-selphid-document-extract.md).

# /api/v1/selphid/document/extract

Extracts raw data (OCR and images) from a tokenized document.

```json
{"openapi":"3.0.0","info":{"title":"SelphID-SDK Rest API","version":"6.21.0"},"security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Default API key header name. It can be overridden at startup with `auth_api_key_header_name`."}},"schemas":{"DocumentExtractionData":{"type":"object","description":"A tokenized document and, additionally, an _extraData_ for registration in Api Tracking.","properties":{"token":{"$ref":"#/components/schemas/DocumentToken"},"extraData":{"$ref":"#/components/schemas/ExtraData"}},"required":["token"]},"DocumentToken":{"type":"string","description":"Tokenized document data (OCR, faceImage, frontImage, backImage), base64-encoded."},"ExtraData":{"type":"string","description":"Tokenized data used to call the Api Tracking service after the operation, base64-encoded."},"DocumentExtractionResult":{"type":"object","description":"The result of a document extraction operation.","properties":{"documentData":{"$ref":"#/components/schemas/OCRData"},"imageData":{"type":"object","properties":{"faceImage":{"type":"string","description":"The raw data of the document's face image, base64-encoded."},"documentFrontImage":{"type":"string","description":"The raw data of the document's front image, base64-encoded."},"documentBackImage":{"type":"string","description":"The raw data of the document's back image, base64-encoded."}},"additionalProperties":{"type":"string"},"description":"Key/value string dictionary with the images detected in the document."},"validTimeStamp":{"$ref":"#/components/schemas/ValidTimeStamp"},"tokenTimeStamp":{"$ref":"#/components/schemas/TokenTimeStamp"},"trackingStatus":{"$ref":"#/components/schemas/TrackingStatus"},"trackingMessage":{"$ref":"#/components/schemas/TrackingMessage"},"sdkDuration":{"$ref":"#/components/schemas/SdkDuration"}}},"OCRData":{"type":"string","description":"String containing a JSON key/value dictionary with the OCR fields detected in a document."},"ValidTimeStamp":{"type":"boolean","description":"In authentication, liveness and extraction operations that involve templateRaws, indicates whether the template's lifetime is valid. See \"options:elapsedAllowedSeconds\". In operations that do not involve raw templates, it is always true."},"TokenTimeStamp":{"type":"string","description":"The token's internal date and time value in \"%Y-%m-%dT%H:%M:%SZ\" format."},"TrackingStatus":{"type":"number","description":"Status returned by the Api Tracking service, or -1 if tracking is not required."},"TrackingMessage":{"type":"string","description":"Message returned by the Api Tracking service, or empty if tracking is not required."},"SdkDuration":{"type":"number","description":"Duration of the operation in milliseconds."},"BadRequestResult":{"type":"object","description":"Result when incorrect parameters arrive in the request.","properties":{"status":{"type":"number"},"error":{"type":"string"},"timeStamp":{"$ref":"#/components/schemas/TimeStamp"}}},"TimeStamp":{"type":"string","description":"A date and time value in \"%Y-%m-%dT%H:%M:%SZ\" format."},"ExceptionResult":{"type":"object","description":"An error occurred in the call to the SelphID-SDK backend.","properties":{"status":{"type":"number"},"error":{"type":"string"},"exception":{"type":"string"},"timeStamp":{"$ref":"#/components/schemas/TimeStamp"}}}}},"paths":{"/api/v1/selphid/document/extract":{"post":{"description":"Extracts raw data (OCR and images) from a tokenized document.","tags":["Onboarding"],"requestBody":{"description":"JSON with the tokenized document in base64 format.","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentExtractionData"}}}},"responses":{"200":{"description":"Result of the document extraction.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/DocumentExtractionResult"}}}},"400":{"description":"Incorrect parameters in the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestResult"}}}},"500":{"description":"An error occurred in the call to the SelphID-SDK backend.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExceptionResult"}}}}}}}}}
```
