Skip to content

VCSP client docs

vericlient.vcsp.client.VcspClient

Bases: Client

Class to interact with the VCSP API.

Source code in src/vericlient/vcsp/client.py
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
class VcspClient(Client):
    """Class to interact with the VCSP API."""

    def __init__(
            self,
            api: str = APIs.VCSP.value,
            apikey: str | None = None,
            timeout: int | None = None,
            environment: str | None = None,
            location: str | None = None,
            url: str | None = None,
            headers: dict | None = None,
    ) -> None:
        """Create the VcspClient class.

        Args:
            api: The API to use
            apikey: The API key to use
            timeout: The timeout to use in the requests
            environment: The environment to use
            location: The location to use
            url: The URL to use in case of a custom target
            headers: The headers to be used in the requests

        """
        super().__init__(
            api=api,
            apikey=apikey,
            timeout=timeout,
            environment=environment,
            location=location,
            url=url,
            headers=headers,
        )
        self._exceptions = {
            "empty_file": EmptyFileError,
            "invalid_claims": InvalidClaimsError,
            "invalid_assurance": InvalidAssuranceError,
            "invalid_tags": InvalidTagsError,
            "invalid_credential_configuration_urn": InvalidCredentialConfigurationUrnError,
            "invalid_assurance_method_urn": InvalidAssuranceMethodUrnError,
            "credential_configuration_urn_already_assigned": CredentialConfigurationUrnAlreadyAssignedError,
            "invalid_audio_format": InvalidAudioFormatError,
            "invalid_signal_noise_ratio": InvalidSnrError,
            "voice_duration_is_not_enough": VoiceDurationIsNotEnoughError,
            "insufficient_quality": InsufficientQualityError,
            "face_not_found": FaceNotFoundError,
            "more_than_one_face": MoreThanOneFaceError,
            "face_too_small_for_ias": FaceTooSmallError,
            "face_alignment": FaceAlignmentError,
            "assurance_validation_error": AssuranceValidationError,
            "assurance_method_not_found": AssuranceMethodNotFoundError,
            "account_not_found": AccountNotFoundError,
            "credential_not_found": CredentialNotFoundError,
            "request_validation": RequestValidationError,
            "unsupported_media_type": UnsupportedMediaTypeError,
        }

    def alive(self) -> bool:
        """Check if the service is alive.

        Returns
            bool: True if the service is alive, False otherwise

        """
        response = self._get(endpoint=VcspEndpoints.ALIVE.value)
        accepted_status_code = 204
        return response.status_code == accepted_status_code

    def _handle_error_response(self, response: Response) -> None:
        """Handle error responses from the API."""
        response_json = response.json()

        exception = response_json.get("error")
        if not exception or exception not in self._exceptions:
            self._raise_server_error(response)

        handler = self._exceptions[exception]
        raise handler()

    def get_credential_configurations(self) -> CredentialConfigurationsOutput:
        """Get all credential configurations.

        Returns:
            CredentialConfigurationsOutput: The output of the credential configurations

        """
        endpoint = VcspEndpoints.CREDENTIAL_CONFIGURATIONS.value
        response = self._get(endpoint=endpoint)
        return CredentialConfigurationsOutput(
            status_code=response.status_code,
            credential_configurations=response.json(),
        )

    def get_assurance_methods(self) -> AssuranceMethodsOutput:
        """Get all assurance methods.

        Returns:
            AssuranceMethodsOutput: The output of the assurance methods

        """
        endpoint = VcspEndpoints.ASSURANCE_METHODS.value
        response = self._get(endpoint=endpoint)
        return AssuranceMethodsOutput(
            status_code=response.status_code,
            assurance_methods=response.json(),
        )

    def get_assurance_method_info(self, data_model: AssuranceMethodInput) -> AssuranceMethodOutput:
        """Get an assurance method.

        Args:
            data_model: The input to get the assurance method

        Returns:
            AssuranceMethodOutput: The output of the assurance method

        """
        endpoint = VcspEndpoints.ASSURANCE_METHOD_URN.value.replace("<urn>", data_model.urn)
        response = self._get(endpoint=endpoint)
        return AssuranceMethodOutput(status_code=response.status_code, **response.json())

    def enroll_subject(self, data_model: EnrollmentInput) -> EnrollmentOutput:
        """Enroll a subject.

        Args:
            data_model: The input to enroll the subject

        Returns:
            EnrollmentOutput: The output of the enrollment

        Raises:
            EmptyFileError: If the file is empty
            InvalidClaimsError: If the claims are invalid
            InvalidAssuranceError: If the assurance is invalid
            InvalidTagsError: If the tags are invalid
            InvalidCredentialConfigurationUrnError: If the credential configuration urn is invalid
            InvalidAssuranceMethodUrnError: If the assurance method urn is invalid
            CredentialConfigurationUrnAlreadyAssignedError: If the credential configuration urn is already assigned
            InvalidAudioFormatError: If the audio format is invalid
            InvalidSnrError: If the signal noise ratio is invalid
            VoiceDurationIsNotEnoughError: If the voice duration is not enough
            InsufficientQualityError: If the quality is insufficient
            FaceAlignmentError: If the face is not aligned
            FaceNotFoundError: If the face is not found
            FaceTooSmallError: If the face is too small
            MoreThanOneFaceError: If there is more than one face
            AssuranceValidationError: If the assurance is invalid
            RequestValidationError: If the request is invalid
            UnsupportedMediaTypeError: If the media type is not supported

        """
        endpoint = VcspEndpoints.ENROLLMENTS.value
        sample = self._get_sample(data_model.sample)
        files = {"sample": sample}
        data = {"applicant": json.dumps(data_model.applicant.model_dump(exclude_none=True))}
        response = self._post(
            endpoint=endpoint,
            files=files,
            data=data,
        )
        return EnrollmentOutput(status_code=response.status_code, **response.json())

    def _get_sample(self, sample: str | bytes) -> tuple[str, bytes, str]:
        """Given a sample, return the filename, the file and the content type."""
        if isinstance(sample, str):
            filename = os.path.basename(sample)
            with open(sample, "rb") as f:
                file = f.read()
            content_type = mimetypes.guess_type(sample)[0]
        if isinstance(sample, bytes):
            filename = "sample"
            file = sample
            content_type = mimetypes.guess_type(sample)[0]
        return filename, file, content_type

    def get_account(self, data_model: GetAccountInput) -> GetAccountOutput:
        """Get an account.

        Args:
            data_model: The input to get the account

        Returns:
            GetAccountOutput: The output of the account

        Raises:
            AccountNotFoundError: If the account is not found

        """
        endpoint = VcspEndpoints.ACCOUNTS.value.replace("<subject_id>", data_model.subject_id)
        response = self._get(endpoint=endpoint)
        return GetAccountOutput(status_code=response.status_code, **response.json())

    def delete_account(self, data_model: DeleteAccountInput) -> None:
        """Delete an account.

        Args:
            data_model: The input to delete the account

        Raises:
            AccountNotFoundError: If the account is not found

        """
        endpoint = VcspEndpoints.ACCOUNTS.value.replace("<subject_id>", data_model.subject_id)
        self._delete(endpoint=endpoint)

    def get_all_subject_credentials(self, data_model: GetCredentialsInput) -> GetCredentialsOutput:
        """Get all credentials for a subject.

        Args:
            data_model: The input to get all credentials for the subject

        Returns:
            GetCredentialsOutput: The output of the credentials

        Raises:
            AccountNotFoundError: If the account is not found

        """
        endpoint = VcspEndpoints.CREDENTIALS.value.replace("<subject_id>", data_model.subject_id)
        response = self._get(endpoint=endpoint)
        return GetCredentialsOutput(credentials=response.json(), status_code=response.status_code)

    def get_credential(self, data_model: GetCredentialInput) -> GetCredentialOutput:
        """Get a credential.

        Args:
            data_model: The input to get the credential

        Returns:
            GetCredentialOutput: The output of the credential

        Raises:
            CredentialNotFoundError: If the credential is not found
            AccountNotFoundError: If the account is not found

        """
        endpoint = VcspEndpoints.CREDENTIAL_ID.value.replace("<subject_id>", data_model.subject_id)
        endpoint = endpoint.replace("<credential_id>", data_model.credential_id)
        response = self._get(endpoint=endpoint)
        return GetCredentialOutput(status_code=response.status_code, **response.json())

    def delete_credential(self, data_model: DeleteCredentialInput) -> None:
        """Delete a credential.

        Args:
            data_model: The input to delete the credential

        """
        endpoint = VcspEndpoints.CREDENTIAL_ID.value.replace("<subject_id>", data_model.subject_id)
        endpoint = endpoint.replace("<credential_id>", data_model.credential_id)
        self._delete(endpoint=endpoint)

__init__(api=APIs.VCSP.value, apikey=None, timeout=None, environment=None, location=None, url=None, headers=None)

Create the VcspClient class.

Parameters:

Name Type Description Default
api str

The API to use

VCSP.value
apikey str | None

The API key to use

None
timeout int | None

The timeout to use in the requests

None
environment str | None

The environment to use

None
location str | None

The location to use

None
url str | None

The URL to use in case of a custom target

None
headers dict | None

The headers to be used in the requests

None
Source code in src/vericlient/vcsp/client.py
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
def __init__(
        self,
        api: str = APIs.VCSP.value,
        apikey: str | None = None,
        timeout: int | None = None,
        environment: str | None = None,
        location: str | None = None,
        url: str | None = None,
        headers: dict | None = None,
) -> None:
    """Create the VcspClient class.

    Args:
        api: The API to use
        apikey: The API key to use
        timeout: The timeout to use in the requests
        environment: The environment to use
        location: The location to use
        url: The URL to use in case of a custom target
        headers: The headers to be used in the requests

    """
    super().__init__(
        api=api,
        apikey=apikey,
        timeout=timeout,
        environment=environment,
        location=location,
        url=url,
        headers=headers,
    )
    self._exceptions = {
        "empty_file": EmptyFileError,
        "invalid_claims": InvalidClaimsError,
        "invalid_assurance": InvalidAssuranceError,
        "invalid_tags": InvalidTagsError,
        "invalid_credential_configuration_urn": InvalidCredentialConfigurationUrnError,
        "invalid_assurance_method_urn": InvalidAssuranceMethodUrnError,
        "credential_configuration_urn_already_assigned": CredentialConfigurationUrnAlreadyAssignedError,
        "invalid_audio_format": InvalidAudioFormatError,
        "invalid_signal_noise_ratio": InvalidSnrError,
        "voice_duration_is_not_enough": VoiceDurationIsNotEnoughError,
        "insufficient_quality": InsufficientQualityError,
        "face_not_found": FaceNotFoundError,
        "more_than_one_face": MoreThanOneFaceError,
        "face_too_small_for_ias": FaceTooSmallError,
        "face_alignment": FaceAlignmentError,
        "assurance_validation_error": AssuranceValidationError,
        "assurance_method_not_found": AssuranceMethodNotFoundError,
        "account_not_found": AccountNotFoundError,
        "credential_not_found": CredentialNotFoundError,
        "request_validation": RequestValidationError,
        "unsupported_media_type": UnsupportedMediaTypeError,
    }

alive()

Check if the service is alive.

Returns bool: True if the service is alive, False otherwise

Source code in src/vericlient/vcsp/client.py
110
111
112
113
114
115
116
117
118
119
def alive(self) -> bool:
    """Check if the service is alive.

    Returns
        bool: True if the service is alive, False otherwise

    """
    response = self._get(endpoint=VcspEndpoints.ALIVE.value)
    accepted_status_code = 204
    return response.status_code == accepted_status_code

delete_account(data_model)

Delete an account.

Parameters:

Name Type Description Default
data_model DeleteAccountInput

The input to delete the account

required

Raises:

Type Description
AccountNotFoundError

If the account is not found

Source code in src/vericlient/vcsp/client.py
245
246
247
248
249
250
251
252
253
254
255
256
def delete_account(self, data_model: DeleteAccountInput) -> None:
    """Delete an account.

    Args:
        data_model: The input to delete the account

    Raises:
        AccountNotFoundError: If the account is not found

    """
    endpoint = VcspEndpoints.ACCOUNTS.value.replace("<subject_id>", data_model.subject_id)
    self._delete(endpoint=endpoint)

delete_credential(data_model)

Delete a credential.

Parameters:

Name Type Description Default
data_model DeleteCredentialInput

The input to delete the credential

required
Source code in src/vericlient/vcsp/client.py
294
295
296
297
298
299
300
301
302
303
def delete_credential(self, data_model: DeleteCredentialInput) -> None:
    """Delete a credential.

    Args:
        data_model: The input to delete the credential

    """
    endpoint = VcspEndpoints.CREDENTIAL_ID.value.replace("<subject_id>", data_model.subject_id)
    endpoint = endpoint.replace("<credential_id>", data_model.credential_id)
    self._delete(endpoint=endpoint)

enroll_subject(data_model)

Enroll a subject.

Parameters:

Name Type Description Default
data_model EnrollmentInput

The input to enroll the subject

required

Returns:

Name Type Description
EnrollmentOutput EnrollmentOutput

The output of the enrollment

Raises:

Type Description
EmptyFileError

If the file is empty

InvalidClaimsError

If the claims are invalid

InvalidAssuranceError

If the assurance is invalid

InvalidTagsError

If the tags are invalid

InvalidCredentialConfigurationUrnError

If the credential configuration urn is invalid

InvalidAssuranceMethodUrnError

If the assurance method urn is invalid

CredentialConfigurationUrnAlreadyAssignedError

If the credential configuration urn is already assigned

InvalidAudioFormatError

If the audio format is invalid

InvalidSnrError

If the signal noise ratio is invalid

VoiceDurationIsNotEnoughError

If the voice duration is not enough

InsufficientQualityError

If the quality is insufficient

FaceAlignmentError

If the face is not aligned

FaceNotFoundError

If the face is not found

FaceTooSmallError

If the face is too small

MoreThanOneFaceError

If there is more than one face

AssuranceValidationError

If the assurance is invalid

RequestValidationError

If the request is invalid

UnsupportedMediaTypeError

If the media type is not supported

Source code in src/vericlient/vcsp/client.py
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
def enroll_subject(self, data_model: EnrollmentInput) -> EnrollmentOutput:
    """Enroll a subject.

    Args:
        data_model: The input to enroll the subject

    Returns:
        EnrollmentOutput: The output of the enrollment

    Raises:
        EmptyFileError: If the file is empty
        InvalidClaimsError: If the claims are invalid
        InvalidAssuranceError: If the assurance is invalid
        InvalidTagsError: If the tags are invalid
        InvalidCredentialConfigurationUrnError: If the credential configuration urn is invalid
        InvalidAssuranceMethodUrnError: If the assurance method urn is invalid
        CredentialConfigurationUrnAlreadyAssignedError: If the credential configuration urn is already assigned
        InvalidAudioFormatError: If the audio format is invalid
        InvalidSnrError: If the signal noise ratio is invalid
        VoiceDurationIsNotEnoughError: If the voice duration is not enough
        InsufficientQualityError: If the quality is insufficient
        FaceAlignmentError: If the face is not aligned
        FaceNotFoundError: If the face is not found
        FaceTooSmallError: If the face is too small
        MoreThanOneFaceError: If there is more than one face
        AssuranceValidationError: If the assurance is invalid
        RequestValidationError: If the request is invalid
        UnsupportedMediaTypeError: If the media type is not supported

    """
    endpoint = VcspEndpoints.ENROLLMENTS.value
    sample = self._get_sample(data_model.sample)
    files = {"sample": sample}
    data = {"applicant": json.dumps(data_model.applicant.model_dump(exclude_none=True))}
    response = self._post(
        endpoint=endpoint,
        files=files,
        data=data,
    )
    return EnrollmentOutput(status_code=response.status_code, **response.json())

get_account(data_model)

Get an account.

Parameters:

Name Type Description Default
data_model GetAccountInput

The input to get the account

required

Returns:

Name Type Description
GetAccountOutput GetAccountOutput

The output of the account

Raises:

Type Description
AccountNotFoundError

If the account is not found

Source code in src/vericlient/vcsp/client.py
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
def get_account(self, data_model: GetAccountInput) -> GetAccountOutput:
    """Get an account.

    Args:
        data_model: The input to get the account

    Returns:
        GetAccountOutput: The output of the account

    Raises:
        AccountNotFoundError: If the account is not found

    """
    endpoint = VcspEndpoints.ACCOUNTS.value.replace("<subject_id>", data_model.subject_id)
    response = self._get(endpoint=endpoint)
    return GetAccountOutput(status_code=response.status_code, **response.json())

get_all_subject_credentials(data_model)

Get all credentials for a subject.

Parameters:

Name Type Description Default
data_model GetCredentialsInput

The input to get all credentials for the subject

required

Returns:

Name Type Description
GetCredentialsOutput GetCredentialsOutput

The output of the credentials

Raises:

Type Description
AccountNotFoundError

If the account is not found

Source code in src/vericlient/vcsp/client.py
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
def get_all_subject_credentials(self, data_model: GetCredentialsInput) -> GetCredentialsOutput:
    """Get all credentials for a subject.

    Args:
        data_model: The input to get all credentials for the subject

    Returns:
        GetCredentialsOutput: The output of the credentials

    Raises:
        AccountNotFoundError: If the account is not found

    """
    endpoint = VcspEndpoints.CREDENTIALS.value.replace("<subject_id>", data_model.subject_id)
    response = self._get(endpoint=endpoint)
    return GetCredentialsOutput(credentials=response.json(), status_code=response.status_code)

get_assurance_method_info(data_model)

Get an assurance method.

Parameters:

Name Type Description Default
data_model AssuranceMethodInput

The input to get the assurance method

required

Returns:

Name Type Description
AssuranceMethodOutput AssuranceMethodOutput

The output of the assurance method

Source code in src/vericlient/vcsp/client.py
160
161
162
163
164
165
166
167
168
169
170
171
172
def get_assurance_method_info(self, data_model: AssuranceMethodInput) -> AssuranceMethodOutput:
    """Get an assurance method.

    Args:
        data_model: The input to get the assurance method

    Returns:
        AssuranceMethodOutput: The output of the assurance method

    """
    endpoint = VcspEndpoints.ASSURANCE_METHOD_URN.value.replace("<urn>", data_model.urn)
    response = self._get(endpoint=endpoint)
    return AssuranceMethodOutput(status_code=response.status_code, **response.json())

get_assurance_methods()

Get all assurance methods.

Returns:

Name Type Description
AssuranceMethodsOutput AssuranceMethodsOutput

The output of the assurance methods

Source code in src/vericlient/vcsp/client.py
146
147
148
149
150
151
152
153
154
155
156
157
158
def get_assurance_methods(self) -> AssuranceMethodsOutput:
    """Get all assurance methods.

    Returns:
        AssuranceMethodsOutput: The output of the assurance methods

    """
    endpoint = VcspEndpoints.ASSURANCE_METHODS.value
    response = self._get(endpoint=endpoint)
    return AssuranceMethodsOutput(
        status_code=response.status_code,
        assurance_methods=response.json(),
    )

get_credential(data_model)

Get a credential.

Parameters:

Name Type Description Default
data_model GetCredentialInput

The input to get the credential

required

Returns:

Name Type Description
GetCredentialOutput GetCredentialOutput

The output of the credential

Raises:

Type Description
CredentialNotFoundError

If the credential is not found

AccountNotFoundError

If the account is not found

Source code in src/vericlient/vcsp/client.py
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
def get_credential(self, data_model: GetCredentialInput) -> GetCredentialOutput:
    """Get a credential.

    Args:
        data_model: The input to get the credential

    Returns:
        GetCredentialOutput: The output of the credential

    Raises:
        CredentialNotFoundError: If the credential is not found
        AccountNotFoundError: If the account is not found

    """
    endpoint = VcspEndpoints.CREDENTIAL_ID.value.replace("<subject_id>", data_model.subject_id)
    endpoint = endpoint.replace("<credential_id>", data_model.credential_id)
    response = self._get(endpoint=endpoint)
    return GetCredentialOutput(status_code=response.status_code, **response.json())

get_credential_configurations()

Get all credential configurations.

Returns:

Name Type Description
CredentialConfigurationsOutput CredentialConfigurationsOutput

The output of the credential configurations

Source code in src/vericlient/vcsp/client.py
132
133
134
135
136
137
138
139
140
141
142
143
144
def get_credential_configurations(self) -> CredentialConfigurationsOutput:
    """Get all credential configurations.

    Returns:
        CredentialConfigurationsOutput: The output of the credential configurations

    """
    endpoint = VcspEndpoints.CREDENTIAL_CONFIGURATIONS.value
    response = self._get(endpoint=endpoint)
    return CredentialConfigurationsOutput(
        status_code=response.status_code,
        credential_configurations=response.json(),
    )

vericlient.vcsp.models

Module to define the models for the VCSP API.

Applicant

Bases: BaseModel

Base class for the Applicant.

Attributes:

Name Type Description
subject_id str | None

The subject_id of the applicant (optional). If not provided, it will be generated by the system and returned in the response

credential_configuration_urn str

The credential configuration urn

tags list[str] | None

The tags of the applicant

claims dict | None

The claims of the applicant

assurance_method_urn str

The assurance method urn

assurance dict

The assurance of the applicant

Source code in src/vericlient/vcsp/models.py
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
class Applicant(BaseModel):
    """Base class for the Applicant.

    Attributes:
        subject_id: The subject_id of the applicant (optional). If not provided, it will
            be generated by the system and returned in the response
        credential_configuration_urn: The credential configuration urn
        tags: The tags of the applicant
        claims: The claims of the applicant
        assurance_method_urn: The assurance method urn
        assurance: The assurance of the applicant

    """

    subject_id: str | None = None
    credential_configuration_urn: str
    tags: list[str] | None = []
    claims: dict | None = {}
    assurance_method_urn: str
    assurance: dict

AssuranceMethodInput

Bases: BaseModel

Input class for the assurance method endpoint.

Attributes:

Name Type Description
urn str

The urn of the assurance method

Source code in src/vericlient/vcsp/models.py
60
61
62
63
64
65
66
67
68
class AssuranceMethodInput(BaseModel):
    """Input class for the assurance method endpoint.

    Attributes:
        urn: The urn of the assurance method

    """

    urn: str

AssuranceMethodOutput

Bases: VcspResponse

Output class for the assurance method endpoint.

Attributes:

Name Type Description
urn str

The urn of the assurance method

schema AssuranceMethodSchema

The schema of the assurance method

Source code in src/vericlient/vcsp/models.py
71
72
73
74
75
76
77
78
79
80
81
class AssuranceMethodOutput(VcspResponse):
    """Output class for the assurance method endpoint.

    Attributes:
        urn: The urn of the assurance method
        schema: The schema of the assurance method

    """

    urn: str
    schema: AssuranceMethodSchema

AssuranceMethodSchema

Bases: BaseModel

Schema class for the assurance method.

Attributes:

Name Type Description
$schema

The schema of the assurance method

title str

The title of the assurance method

type str

The type of the assurance method

properties dict

The properties of the assurance method

required list[str] | None

The required properties of the assurance method

additionalProperties bool

Whether additional properties are allowed

Source code in src/vericlient/vcsp/models.py
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
class AssuranceMethodSchema(BaseModel):
    """Schema class for the assurance method.

    Attributes:
        $schema: The schema of the assurance method
        title: The title of the assurance method
        type: The type of the assurance method
        properties: The properties of the assurance method
        required: The required properties of the assurance method
        additionalProperties: Whether additional properties are allowed

    """

    schema: str = Field(alias="$schema")
    title: str
    type: str
    properties: dict
    required: list[str] | None = None
    additionalProperties: bool      # noqa: N815

AssuranceMethodsOutput

Bases: VcspResponse

Output class for the assurance methods endpoint.

Attributes:

Name Type Description
assurance_methods list[str]

The assurance methods

Source code in src/vericlient/vcsp/models.py
28
29
30
31
32
33
34
35
36
class AssuranceMethodsOutput(VcspResponse):
    """Output class for the assurance methods endpoint.

    Attributes:
        assurance_methods: The assurance methods

    """

    assurance_methods: list[str]

CredentialConfigurationsOutput

Bases: VcspResponse

Output class for the credential configurations endpoint.

Attributes:

Name Type Description
credential_configurations list[str]

The credential configurations

Source code in src/vericlient/vcsp/models.py
17
18
19
20
21
22
23
24
25
class CredentialConfigurationsOutput(VcspResponse):
    """Output class for the credential configurations endpoint.

    Attributes:
        credential_configurations: The credential configurations

    """

    credential_configurations: list[str]

CredentialInput

Bases: BaseModel

Input class to define a credential.

Attributes:

Name Type Description
credential_id str

The credential_id of the applicant

Source code in src/vericlient/vcsp/models.py
174
175
176
177
178
179
180
181
182
class CredentialInput(BaseModel):
    """Input class to define a credential.

    Attributes:
        credential_id: The credential_id of the applicant

    """

    credential_id: str

DeleteAccountInput

Bases: SubjectInput

Input class for the delete account endpoint.

Attributes:

Name Type Description
subject_id

The account_id to delete

Source code in src/vericlient/vcsp/models.py
271
272
273
274
275
276
277
class DeleteAccountInput(SubjectInput):
    """Input class for the delete account endpoint.

    Attributes:
        subject_id: The account_id to delete

    """

DeleteCredentialInput

Bases: SubjectInput, CredentialInput

Input class for the delete credential endpoint.

Attributes:

Name Type Description
credential_id

The credential_id to delete

subject_id

The subject from which the credential will be deleted

Source code in src/vericlient/vcsp/models.py
194
195
196
197
198
199
200
201
class DeleteCredentialInput(SubjectInput, CredentialInput):
    """Input class for the delete credential endpoint.

    Attributes:
        credential_id: The credential_id to delete
        subject_id: The subject from which the credential will be deleted

    """

DeleteSubjectInput

Bases: SubjectInput

Input class for the delete account endpoint.

Attributes:

Name Type Description
subject_id

The account_id to delete

Source code in src/vericlient/vcsp/models.py
185
186
187
188
189
190
191
class DeleteSubjectInput(SubjectInput):
    """Input class for the delete account endpoint.

    Attributes:
        subject_id: The account_id to delete

    """

EnrollmentInput

Bases: BaseModel

Input class for the enrollment endpoint.

Attributes:

Name Type Description
sample str | bytes

The sample to generate the credential with. It can be a path to a file or a bytes object with the audio content

applicant Applicant

The applicant to enroll

Source code in src/vericlient/vcsp/models.py
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
class EnrollmentInput(BaseModel):
    """Input class for the enrollment endpoint.

    Attributes:
        sample: The sample to generate the credential with.
            It can be a path to a file or a bytes object
            with the audio content
        applicant: The applicant to enroll

    """

    sample: str | bytes
    applicant: Applicant

    @field_validator("sample")
    def must_be_str_or_bytes(cls, value: object):
        if not isinstance(value, (str, bytes)):
            error = "sample must be a string or a bytes object"
            raise TypeError(error)
        return value

    class Config:
        arbitrary_types_allowed = True

EnrollmentOutput

Bases: BaseModel

Output class for the enrollment endpoint.

Attributes:

Name Type Description
credential_id str

The credential_id of the applicant

subject_id str

The subject_id of the applicant

Source code in src/vericlient/vcsp/models.py
150
151
152
153
154
155
156
157
158
159
160
class EnrollmentOutput(BaseModel):
    """Output class for the enrollment endpoint.

    Attributes:
        credential_id: The credential_id of the applicant
        subject_id: The subject_id of the applicant

    """

    credential_id: str
    subject_id: str

GetAccountInput

Bases: SubjectInput

Input class for the get account endpoint.

Attributes:

Name Type Description
subject_id

The account_id to get

Source code in src/vericlient/vcsp/models.py
204
205
206
207
208
209
210
class GetAccountInput(SubjectInput):
    """Input class for the get account endpoint.

    Attributes:
        subject_id: The account_id to get

    """

GetAccountOutput

Bases: VcspResponse

Output class for the get account endpoint.

Attributes:

Name Type Description
credentials list[str]

The credentials of the applicant

updated_at str

The updated_at date

created_at str

The created_at date

subject_id str

The subject_id of the applicant

Source code in src/vericlient/vcsp/models.py
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
class GetAccountOutput(VcspResponse):
    """Output class for the get account endpoint.

    Attributes:
        credentials: The credentials of the applicant
        updated_at: The updated_at date
        created_at: The created_at date
        subject_id: The subject_id of the applicant

    """

    credentials: list[str]
    updated_at: str
    created_at: str
    subject_id: str

GetCredentialInput

Bases: SubjectInput, CredentialInput

Input class for the get a specific credential endpoint.

Attributes:

Name Type Description
subject_id

The subject_id to get the credential from

credential_id

The credential_id to get

Source code in src/vericlient/vcsp/models.py
213
214
215
216
217
218
219
220
class GetCredentialInput(SubjectInput, CredentialInput):
    """Input class for the get a specific credential endpoint.

    Attributes:
        subject_id: The subject_id to get the credential from
        credential_id: The credential_id to get

    """

GetCredentialOutput

Bases: BaseModel

Output class for the get credential endpoint.

Attributes:

Name Type Description
sample Sample

The sample of the applicant

groups list[str]

The groups of the applicant

issuer str

The issuer

id str

The id of the applicant

updated_at str

The updated_at date

created_at str

The created_at date

valid_from str

The valid_from date

valid_until str

The valid_until date

credential_configuration_urn str

The credential_configuration_urn

tags list[str]

The tags of the applicant

claims dict

The claims of the applicant

Source code in src/vericlient/vcsp/models.py
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
class GetCredentialOutput(BaseModel):
    """Output class for the get credential endpoint.

    Attributes:
        sample: The sample of the applicant
        groups: The groups of the applicant
        issuer: The issuer
        id: The id of the applicant
        updated_at: The updated_at date
        created_at: The created_at date
        valid_from: The valid_from date
        valid_until: The valid_until date
        credential_configuration_urn: The credential_configuration_urn
        tags: The tags of the applicant
        claims: The claims of the applicant

    """

    sample: Sample
    groups: list[str]
    issuer: str
    id: str
    updated_at: str
    created_at: str
    valid_from: str
    valid_until: str
    credential_configuration_urn: str
    tags: list[str]
    claims: dict

GetCredentialsInput

Bases: SubjectInput

Input class for the get all credentials from a subject endpoint.

Attributes:

Name Type Description
subject_id

The account_id to get the credentials from

Source code in src/vericlient/vcsp/models.py
280
281
282
283
284
285
286
class GetCredentialsInput(SubjectInput):
    """Input class for the get all credentials from a subject endpoint.

    Attributes:
        subject_id: The account_id to get the credentials from

    """

GetCredentialsOutput

Bases: VcspResponse

Output class for the get all credentials from a subject endpoint.

Attributes:

Name Type Description
credentials list[GetCredentialOutput]

The credentials of the applicant

Source code in src/vericlient/vcsp/models.py
289
290
291
292
293
294
295
296
297
class GetCredentialsOutput(VcspResponse):
    """Output class for the get all credentials from a subject endpoint.

    Attributes:
        credentials: The credentials of the applicant

    """

    credentials: list[GetCredentialOutput]

Sample

Bases: BaseModel

Base class for the Sample.

Attributes:

Name Type Description
valid_from str

The date from which the sample is valid

valid_until str

The date until which the sample is valid

type str

The type of the sample, e.g. "voice", "face"

content_type str

The content type of the sample, e.g. "audio/wav", "image/jpeg"

analysis dict

The analysis of the sample

Source code in src/vericlient/vcsp/models.py
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
class Sample(BaseModel):
    """Base class for the Sample.

    Attributes:
        valid_from: The date from which the sample is valid
        valid_until: The date until which the sample is valid
        type: The type of the sample, e.g. "voice", "face"
        content_type: The content type of the sample, e.g. "audio/wav", "image/jpeg"
        analysis: The analysis of the sample

    """

    valid_from: str
    valid_until: str
    type: str
    content_type: str
    analysis: dict

SubjectInput

Bases: BaseModel

Input class to define a subject.

Attributes:

Name Type Description
subject_id str

The subject_id of the applicant

Source code in src/vericlient/vcsp/models.py
163
164
165
166
167
168
169
170
171
class SubjectInput(BaseModel):
    """Input class to define a subject.

    Attributes:
        subject_id: The subject_id of the applicant

    """

    subject_id: str

VcspResponse

Bases: BaseModel

Base class for the VCSP API responses.

Attributes:

Name Type Description
status_code int

The status code of the response

Source code in src/vericlient/vcsp/models.py
 6
 7
 8
 9
10
11
12
13
14
class VcspResponse(BaseModel):
    """Base class for the VCSP API responses.

    Attributes:
        status_code: The status code of the response

    """

    status_code: int

vericlient.vcsp.exceptions

Module to define the exceptions for the VCSP API.

AccountNotFoundError

Bases: VcspError

Exception raised for account not found.

Source code in src/vericlient/vcsp/exceptions.py
164
165
166
167
168
169
class AccountNotFoundError(VcspError):
    """Exception raised for account not found."""

    def __init__(self) -> None:
        message = "Account not found"
        super().__init__(message)

AssuranceMethodNotFoundError

Bases: VcspError

Exception raised for assurance method not found.

Source code in src/vericlient/vcsp/exceptions.py
148
149
150
151
152
153
class AssuranceMethodNotFoundError(VcspError):
    """Exception raised for assurance method not found."""

    def __init__(self) -> None:
        message = "Assurance method not found"
        super().__init__(message)

AssuranceValidationError

Bases: VcspError

Exception raised for assurance validation error.

Source code in src/vericlient/vcsp/exceptions.py
156
157
158
159
160
161
class AssuranceValidationError(VcspError):
    """Exception raised for assurance validation error."""

    def __init__(self) -> None:
        message = "Assurance validation error"
        super().__init__(message)

CredentialConfigurationUrnAlreadyAssignedError

Bases: VcspError

Exception raised for already assigned credential configuration urn.

Source code in src/vericlient/vcsp/exceptions.py
76
77
78
79
80
81
class CredentialConfigurationUrnAlreadyAssignedError(VcspError):
    """Exception raised for already assigned credential configuration urn."""

    def __init__(self) -> None:
        message = "The specified credential configuration URN is already assigned to the applicant"
        super().__init__(message)

CredentialNotFoundError

Bases: VcspError

Exception raised for credential not found.

Source code in src/vericlient/vcsp/exceptions.py
172
173
174
175
176
177
class CredentialNotFoundError(VcspError):
    """Exception raised for credential not found."""

    def __init__(self) -> None:
        message = "Credential not found"
        super().__init__(message)

EmptyFileError

Bases: VcspError

Exception raised for empty files.

Source code in src/vericlient/vcsp/exceptions.py
12
13
14
15
16
17
class EmptyFileError(VcspError):
    """Exception raised for empty files."""

    def __init__(self) -> None:
        message = "The file provided is empty"
        super().__init__(message)

FaceAlignmentError

Bases: VcspError

Exception raised for face alignment error.

Source code in src/vericlient/vcsp/exceptions.py
140
141
142
143
144
145
class FaceAlignmentError(VcspError):
    """Exception raised for face alignment error."""

    def __init__(self) -> None:
        message = "Face alignment error"
        super().__init__(message)

FaceNotFoundError

Bases: VcspError

Exception raised for face not found.

Source code in src/vericlient/vcsp/exceptions.py
116
117
118
119
120
121
class FaceNotFoundError(VcspError):
    """Exception raised for face not found."""

    def __init__(self) -> None:
        message = "Face not found"
        super().__init__(message)

FaceTooSmallError

Bases: VcspError

Exception raised for face too small.

Source code in src/vericlient/vcsp/exceptions.py
132
133
134
135
136
137
class FaceTooSmallError(VcspError):
    """Exception raised for face too small."""

    def __init__(self) -> None:
        message = "Face too small"
        super().__init__(message)

InsufficientQualityError

Bases: VcspError

Exception raised for insufficient quality.

Source code in src/vericlient/vcsp/exceptions.py
108
109
110
111
112
113
class InsufficientQualityError(VcspError):
    """Exception raised for insufficient quality."""

    def __init__(self) -> None:
        message = "The audio quality is insufficient or may contain more than one speaker"
        super().__init__(message)

InvalidAssuranceError

Bases: VcspError

Exception raised for invalid assurance.

Source code in src/vericlient/vcsp/exceptions.py
44
45
46
47
48
49
class InvalidAssuranceError(VcspError):
    """Exception raised for invalid assurance."""

    def __init__(self) -> None:
        message = "The assurance provided doesn't match the required schema"
        super().__init__(message)

InvalidAssuranceMethodUrnError

Bases: VcspError

Exception raised for invalid assurance method.

Source code in src/vericlient/vcsp/exceptions.py
68
69
70
71
72
73
class InvalidAssuranceMethodUrnError(VcspError):
    """Exception raised for invalid assurance method."""

    def __init__(self) -> None:
        message = "Specified assurance method URN doesn't exist"
        super().__init__(message)

InvalidAudioFormatError

Bases: VcspError

Exception raised for invalid audio format.

Source code in src/vericlient/vcsp/exceptions.py
84
85
86
87
88
89
class InvalidAudioFormatError(VcspError):
    """Exception raised for invalid audio format."""

    def __init__(self) -> None:
        message = "The audio format is not supported"
        super().__init__(message)

InvalidClaimsError

Bases: VcspError

Exception raised for invalid claims.

Source code in src/vericlient/vcsp/exceptions.py
36
37
38
39
40
41
class InvalidClaimsError(VcspError):
    """Exception raised for invalid claims."""

    def __init__(self) -> None:
        message = "The claims provided don't match the required schema"
        super().__init__(message)

InvalidCredentialConfigurationUrnError

Bases: VcspError

Exception raised for invalid credential configuration urn.

Source code in src/vericlient/vcsp/exceptions.py
60
61
62
63
64
65
class InvalidCredentialConfigurationUrnError(VcspError):
    """Exception raised for invalid credential configuration urn."""

    def __init__(self) -> None:
        message = "Specified credential configuration URN doesn't exist"
        super().__init__(message)

InvalidSnrError

Bases: VcspError

Exception raised for invalid signal noise ratio.

Source code in src/vericlient/vcsp/exceptions.py
92
93
94
95
96
97
class InvalidSnrError(VcspError):
    """Exception raised for invalid signal noise ratio."""

    def __init__(self) -> None:
        message = "Invalid signal noise ratio"
        super().__init__(message)

InvalidTagsError

Bases: VcspError

Exception raised for invalid tags.

Source code in src/vericlient/vcsp/exceptions.py
52
53
54
55
56
57
class InvalidTagsError(VcspError):
    """Exception raised for invalid tags."""

    def __init__(self) -> None:
        message = "Specified tags don't exist"
        super().__init__(message)

MoreThanOneFaceError

Bases: VcspError

Exception raised for more than one face.

Source code in src/vericlient/vcsp/exceptions.py
124
125
126
127
128
129
class MoreThanOneFaceError(VcspError):
    """Exception raised for more than one face."""

    def __init__(self) -> None:
        message = "More than one face found"
        super().__init__(message)

RequestValidationError

Bases: VcspError

Exception raised for request validation error.

Source code in src/vericlient/vcsp/exceptions.py
20
21
22
23
24
25
class RequestValidationError(VcspError):
    """Exception raised for request validation error."""

    def __init__(self) -> None:
        message = "The request is invalid"
        super().__init__(message)

UnsupportedMediaTypeError

Bases: VcspError

Exception raised for unsupported media type.

Source code in src/vericlient/vcsp/exceptions.py
28
29
30
31
32
33
class UnsupportedMediaTypeError(VcspError):
    """Exception raised for unsupported media type."""

    def __init__(self) -> None:
        message = "The media type is not supported"
        super().__init__(message)

VcspError

Bases: VeriClientError

Base class for exceptions in the VCSP API.

Source code in src/vericlient/vcsp/exceptions.py
5
6
7
8
9
class VcspError(VeriClientError):
    """Base class for exceptions in the VCSP API."""

    def __init__(self, message: str) -> None:
        super().__init__(message)

VoiceDurationIsNotEnoughError

Bases: VcspError

Exception raised for voice duration not enough.

Source code in src/vericlient/vcsp/exceptions.py
100
101
102
103
104
105
class VoiceDurationIsNotEnoughError(VcspError):
    """Exception raised for voice duration not enough."""

    def __init__(self) -> None:
        message = "Voice duration is not enough"
        super().__init__(message)