Skip to content

Latest commit

 

History

History
140 lines (90 loc) · 8.59 KB

README.md

File metadata and controls

140 lines (90 loc) · 8.59 KB

Clients

(clients)

Overview

The Client object tracks sessions, as well as the state of any sign in and sign up attempts, for a given device. https://clerk.com/docs/reference/clerkjs/client

Available Operations

  • list - List all clients ⚠️ Deprecated
  • verify - Verify a client
  • get - Get a client

list

Returns a list of all clients. The clients are returned sorted by creation date, with the newest clients appearing first. Warning: the endpoint is being deprecated and will be removed in future versions.

⚠️ DEPRECATED: This will be removed in a future release, please migrate away from it as soon as possible.

Example Usage

from clerk_backend_api import Clerk

with Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:

    res = clerk.clients.list(limit=20, offset=10)

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
limit Optional[int] Applies a limit to the number of results returned.
Can be used for paginating the results together with offset.
20
offset Optional[int] Skip the first offset results when paginating.
Needs to be an integer greater or equal to zero.
To be used in conjunction with limit.
10
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

List[models.Client]

Errors

Error Type Status Code Content Type
models.ClerkErrors 400, 401, 410, 422 application/json
models.SDKError 4XX, 5XX */*

verify

Verifies the client in the provided token

Example Usage

from clerk_backend_api import Clerk

with Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:

    res = clerk.clients.verify(request={
        "token": "jwt_token_example",
    })

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
request models.VerifyClientRequestBody ✔️ The request object to use for the request.
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.Client

Errors

Error Type Status Code Content Type
models.ClerkErrors 400, 401, 404 application/json
models.SDKError 4XX, 5XX */*

get

Returns the details of a client.

Example Usage

from clerk_backend_api import Clerk

with Clerk(
    bearer_auth="<YOUR_BEARER_TOKEN_HERE>",
) as clerk:

    res = clerk.clients.get(client_id="cli_123456789")

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
client_id str ✔️ Client ID. cli_123456789
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.Client

Errors

Error Type Status Code Content Type
models.ClerkErrors 400, 401, 404 application/json
models.SDKError 4XX, 5XX */*