> 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-pt-br/sdks/backend-sdk/backend1n/technical_documentation/api_reference/extract/extract-template.md).

# /extract/template

This endpoint extracts the `facialTemplate` from a raw templateRaw. It is for information only and does not modify the database. A `facialTemplateRaw` that is not a valid template, as well as `options` with incorrect types, is rejected with 400.

```json
{"openapi":"3.0.1","info":{"title":"Backend1n-Service REST API","version":"5.0.0"},"servers":[{"url":"http://127.0.0.1:6982/"}],"security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT","description":"JWT signed with HS256 (shared secret `auth_jwt_secret`) and with a non-expired `exp` claim; if it includes `nbf`, it must be currently valid. Only applied if `auth_enabled` is true and `auth_accept_authorization_header` is true. The `Bearer` scheme is case-insensitive.\n"},"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"The same JWT sent in an API key header. The default name is `x-api-key` and it can be changed with `auth_api_key_header_name`; only applied if `auth_accept_api_key_header` is true. If both headers are sent, `Authorization` takes precedence.\n"}},"schemas":{"ExtractTemplateBody":{"type":"object","description":"Body for the extraction request from a template","properties":{"facialTemplateRaw":{"$ref":"#/components/schemas/FacialTemplateRaw"},"options":{"$ref":"#/components/schemas/ExtractOptions"}},"required":["facialTemplateRaw"]},"FacialTemplateRaw":{"type":"string","description":"An extended token that contains biometric templates and metadata. Storing it in databases is recommended because it remains valid across engine versions (it can be updated automatically if the extraction technology changes; see `updatedTemplateRaw`). Like the rest of the tokens, its value changes on every extraction (it carries a timestamp): two extractions of the same image do not give the same text, but they identify the same person. It is encoded in RFC4648 base64.\n"},"ExtractOptions":{"type":"object","description":"Options when extracting biometric templates.","properties":{"templateRawExtraction":{"$ref":"#/components/schemas/TemplateRawExraction"}}},"TemplateRawExraction":{"type":"boolean","default":false,"description":"If true, the templateRaw will be computed and returned. If false or omitted, the response does not include `facialTemplateRaw`.\n"},"ExtractResponse":{"type":"object","description":"Biometric extraction response. `facialTemplateRaw` is only present if the request asked for `templateRawExtraction: true`.\n","properties":{"facialTemplate":{"$ref":"#/components/schemas/FacialTemplate"},"facialTemplateRaw":{"$ref":"#/components/schemas/FacialTemplateRaw"},"updatedTemplateRaw":{"$ref":"#/components/schemas/UpdatedTemplateRaw"}}},"FacialTemplate":{"type":"string","description":"Facial biometric template, encoded in RFC4648 base64. It is a timestamped token: extracting the same image twice produces different values (it changes every second), so it must not be compared or used as a key. It is not the input of any endpoint.\n"},"UpdatedTemplateRaw":{"type":"boolean","default":false,"description":"If true, the returned templateRaw is new (it was generated or updated in this operation) and it should be stored in place of the previous one. When extracting from an image it is true; when extracting from a valid templateRaw (`/extract/template`) it is false.\n"},"BadRequestResult":{"type":"object","description":"Result when incorrect parameters arrive in the request.","properties":{"status":{"type":"number"},"error":{"type":"string"},"message":{"type":"string","description":"Specific description of the reason for the error. It is the only field that indicates the real cause."},"timeStamp":{"$ref":"#/components/schemas/TimeStamp"}}},"TimeStamp":{"type":"string","description":"A date/time value (UTC) in \"%Y-%m-%dT%H:%M:%SZ\" format."},"UnauthorizedResult":{"type":"object","description":"JWT authentication is enabled and the request does not pass it. It is accompanied by the header `WWW-Authenticate: Bearer`. Values of `message`: `Missing authentication token` (no token or unsupported scheme), `JWT token validation failed` (invalid signature, algorithm or format), `JWT token is expired`, `JWT token does not include exp claim` and `JWT token is not yet valid` (future `nbf`).\n","properties":{"status":{"type":"number"},"error":{"type":"string"},"message":{"type":"string"},"timeStamp":{"$ref":"#/components/schemas/TimeStamp"}}},"ExceptionResult":{"type":"object","description":"An error occurred while calling the backend services.","properties":{"status":{"type":"number"},"error":{"type":"string"},"exception":{"type":"string","description":"Specific description of the reason for the exception (internal service text; it is not part of the contract)."},"timeStamp":{"$ref":"#/components/schemas/TimeStamp"}}}},"responses":{"Unauthorized":{"description":"JWT authentication is enabled and the token is missing or invalid.","headers":{"WWW-Authenticate":{"schema":{"type":"string"}}},"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UnauthorizedResult"}}}},"PayloadTooLarge":{"description":"The request body exceeds `client_max_body_size`. It is returned with no body and the connection is closed."}}},"paths":{"/extract/template":{"post":{"description":"This endpoint extracts the `facialTemplate` from a raw templateRaw. It is for information only and does not modify the database. A `facialTemplateRaw` that is not a valid template, as well as `options` with incorrect types, is rejected with 400.\n","tags":["Extract"],"requestBody":{"description":"JSON with the input raw template encoded in RFC4648 base64 format.","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractTemplateBody"}}}},"responses":{"200":{"description":"The result of the extraction.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExtractResponse"}}}},"400":{"description":"Incorrect parameters arrive in the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestResult"}}}},"401":{"$ref":"#/components/responses/Unauthorized"},"413":{"$ref":"#/components/responses/PayloadTooLarge"},"500":{"description":"An error occurred while calling the backend.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExceptionResult"}}}}}}}}}
```
