Skip to main content

Authenticity Verification Streaming

Endpoint

This WebSocket endpoint provides real-time audio authenticity verification using a secure, full-duplex connection. TLS encryption protects your connection and data, with a minimum supported version of TLS 1.2.

Detail

DetailDescription
Pathwss://api.loccus.ai/v1/spaces/{owner}/{space}/verify/authenticity

Headers

HeaderValueDescription
AuthorizationBearer {token}The bearer token of the user.

Accepts

TypeDescription
Raw Audio File DataThe format and codec of the media file must be decodable by FFmpeg.
MessagesJSON formatted operations.

Requests

Start Stream Message

The first message sent to the server to start the audio stream. This message is a JSON object with the properties below.

PropertyTypeDescription
aliasstring | nullThe alias of the new authenticity verification.
modelstringThe model used to perform the new authenticity verification.
audioAliasstring | nullThe alias of the new audio.

Example

{
"alias": "Verification A",
"model": "default",
"audioAlias": "Audio A"
}

Audio Packets

Audio packets are transmitted to the streaming endpoint as binary WebSocket messages, with payloads containing the raw audio data. Packets can be of any size. The server sends chunk scores when the cumulative duration of uploaded audio matches the chunk size defined in the model definition.

Close Stream

To close the stream, send a close stream message to the server. This message instructs the server to close the connection. After receiving the close stream message, the server will send the last chunk's score, followed by the created authenticity verification, and then close the connection.

Example

{
"type": "close"
}

Responses

Server responses are sent as JSON objects with the properties below. The field type in the response indicates the type of message received.

Chunk Score

The server sends chunk scores when the cumulative duration of uploaded audio packets matches the chunk duration defined in the model definition.

Example

{
"type": "chunk",
"chunk": {
"startTime": "PT0S",
"endTime": "PT3.500S",
"label": "validVoice",
"scores": {
"synthesis": 0.85
}
}
}

Verification

The server sends the authenticity verification when the streaming is closed.

Example

{
"type": "verification",
"verification": {
"id": "00000000-0000-0000-0000-000000000000",
"handle": "verification-a",
"alias": "Verification A",
"state": "performed",
"model": "default/v1",
"audio": {
"handle": "audio-a",
"alias": "Audio A",
"state": "available"
},
"scores": {
"synthesis": 0.85
},
"chunks": 1,
"createdAt": "2023-01-01T00:00:00.000000Z",
"performedAt": "2023-01-01T00:00:00.000000Z"
}
}

Showcase

The following diagram illustrates the sequence of messages exchanged during the authenticity verification streaming process.