> 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/voice/technical_documentation/api_reference/authentication/api-v1-authentication.md).

# /api/v1/authentication

This endpoint is used to authenticate a voice. It receives an audio file and a voice template, and returns a boolean value indicating whether the voice belongs to the same person as the one in the voice template, as well as a probability indicating the similarity between both voices.

```json
{"openapi":"3.0.1","info":{"title":"Voice-Service REST API","version":"3.2.0"},"servers":[{"url":"http://127.0.0.1:6982/"}],"security":[{"BearerAuth":[]},{"ApiKeyAuth":[]}],"components":{"securitySchemes":{"BearerAuth":{"type":"http","scheme":"bearer","bearerFormat":"JWT"},"ApiKeyAuth":{"type":"apiKey","in":"header","name":"x-api-key","description":"Default name of the API key header. It can be overridden at startup with `auth_api_key_header_name`."}},"schemas":{"AuthenticationBody":{"type":"object","description":"Authentication request body","properties":{"audio":{"$ref":"#/components/schemas/AudioBuffer"},"template":{"$ref":"#/components/schemas/AudioTemplate"},"check_liveness":{"$ref":"#/components/schemas/CheckLiveness"},"check_quality":{"$ref":"#/components/schemas/CheckQuality"},"liveness_threshold":{"$ref":"#/components/schemas/LivenessThreshold"},"minimum_snr_db":{"$ref":"#/components/schemas/MinimumSnrDb"},"minimum_speech_duration_ms":{"$ref":"#/components/schemas/MinimumAudioLengthMs"},"minimum_speech_relative_length":{"$ref":"#/components/schemas/MinimumSpeechRelativeLength"},"maximum_multiple_speakers_detector_score":{"$ref":"#/components/schemas/MaximumMultipleSpeakersDetectorScore"},"extra_data":{"$ref":"#/components/schemas/ExtraData"}},"required":["audio","template"]},"AudioBuffer":{"type":"string","description":"Raw audio buffer in WAV, OPUS/OGG, MP3 or AAC format, encoded in base64 RFC4648. The audio may or may not be encrypted."},"AudioTemplate":{"type":"string","description":"Biometric template buffer, obtained from Enrollment(), encrypted and encoded in base64 RFC4648."},"CheckLiveness":{"type":"boolean","default":false,"description":"If true, a liveness check will be performed"},"CheckQuality":{"type":"boolean","default":true,"description":"If true, a quality check will be performed"},"LivenessThreshold":{"type":"number","default":0.5,"description":"Threshold for liveness detection. If the liveness probability is below this value, the audio is considered invalid."},"MinimumSnrDb":{"type":"number","description":"Minimum SNR in dB for the audio to be considered valid.","default":8},"MinimumAudioLengthMs":{"type":"number","description":"Minimum audio duration in milliseconds for it to be considered valid.","default":1000},"MinimumSpeechRelativeLength":{"type":"number","description":"Minimum relative speech length (speech length relative to the total audio duration).","default":0},"MaximumMultipleSpeakersDetectorScore":{"type":"number","description":"Maximum score allowed by the multiple speakers detector.","default":1},"ExtraData":{"type":"string","description":"Tokenized data to invoke the Api Tracking service after the operation, encoded in base64."},"AuthenticationResponse":{"type":"object","description":"Authentication response","properties":{"operation_result":{"$ref":"#/components/schemas/OperationResult"},"match":{"$ref":"#/components/schemas/Match"},"liveness_score":{"$ref":"#/components/schemas/LivenessScore"},"matching_score":{"$ref":"#/components/schemas/MatchingScore"},"snr_db_detected":{"$ref":"#/components/schemas/SnrDbDetected"},"speech_length_ms_detected":{"$ref":"#/components/schemas/SpeechLengthMsDetected"},"speech_relative_length_detected":{"$ref":"#/components/schemas/SpeechRelativeLengthDetected"},"multiple_speakers_score_detected":{"$ref":"#/components/schemas/MultipleSpeakersScoreDetected"},"tracking_status":{"$ref":"#/components/schemas/TrackingStatus"},"tracking_message":{"$ref":"#/components/schemas/TrackingMessage"}}},"OperationResult":{"type":"number","description":"Result of the operation.","enum":["NOISY                          = 0","LONG_REVERBERATION             = 1","SMALL_SPEECH                   = 2","OK                             = 3","NOT_EVALUATED                  = 4","SPOOF                          = 5","DUPLICATED_AUDIO               = 6","DIFFERENT_VOICES               = 7","EMPTY_AUDIO                    = 8","TOO_MANY_AUDIOS                = 9","NOT_ENOUGH_GOOD_AUDIOS         = 10","CONFIG_MANAGER_ERROR           = 11","INVALID_LICENSE                = 12","EXPIRED                        = 13","SUSPENDED                      = 14","E_SYSTEM_PERMISSION            = 15","E_WMIC                         = 16","E_INET                         = 17","E_NET_PROXY                    = 18","E_REVOKED                      = 19","E_LICENSE_KEY                  = 20","E_ACTIVATION_LIMIT             = 21","E_VM                           = 22","E_COUNTRY                      = 23","E_IP                           = 24","E_CONTAINER                    = 25","DATA_NOT_FOUND                 = 26","ENVIRONMENT_VARIABLE_NOT_FOUND = 27","SMALL_RELATIVE_SPEECH          = 28","MULTIPLE_SPEAKERS              = 29"]},"Match":{"type":"boolean","description":"Indicates whether the audio matches the template"},"LivenessScore":{"type":"number","description":"Liveness probability"},"MatchingScore":{"type":"number","description":"Matching probability"},"SnrDbDetected":{"type":"number","description":"SNR in dB detected in the audio."},"SpeechLengthMsDetected":{"type":"number","description":"Speech duration in milliseconds detected in the audio."},"SpeechRelativeLengthDetected":{"type":"number","description":"Relative speech length detected in the audio."},"MultipleSpeakersScoreDetected":{"type":"number","description":"Multiple speakers score detected in the audio."},"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."},"BadRequestResult":{"type":"object","description":"Result returned when the request contains incorrect parameters.","properties":{"status":{"type":"number"},"error":{"type":"string"},"timeStamp":{"$ref":"#/components/schemas/TimeStamp"}}},"TimeStamp":{"type":"string","description":"A date/time value in the format \"%Y-%m-%dT%H:%M:%SZ\"."},"ExceptionResult":{"type":"object","description":"An error occurred while calling the Voice-SDK backend.","properties":{"status":{"type":"number"},"error":{"type":"string"},"exception":{"type":"string"},"timeStamp":{"$ref":"#/components/schemas/TimeStamp"}}}}},"paths":{"/api/v1/authentication":{"post":{"description":"This endpoint is used to authenticate a voice. It receives an audio file and a voice template, and returns a boolean value indicating whether the voice belongs to the same person as the one in the voice template, as well as a probability indicating the similarity between both voices.","tags":["Authentication"],"requestBody":{"description":"JSON with the input voice and the template, encrypted and encoded in base64 RFC4648 format","required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthenticationBody"}}}},"responses":{"200":{"description":"The result of the authentication. The *_detected fields are only present when the audio quality check fails.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AuthenticationResponse"}}}},"400":{"description":"The request contains incorrect parameters.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/BadRequestResult"}}}},"500":{"description":"An error occurred while calling the Voice-SDK backend.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ExceptionResult"}}}}}}}}}
```
