Skip to content

Latest commit

 

History

History
178 lines (115 loc) · 9.36 KB

File metadata and controls

178 lines (115 loc) · 9.36 KB

EmailAddresses

(email_addresses)

Overview

Available Operations

  • create - Create an email address
  • get - Retrieve an email address
  • delete - Delete an email address
  • update - Update an email address

create

Create a new email address

Example Usage

from clerk_backend_api import Clerk

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

    res = clerk.email_addresses.create(request={
        "user_id": "user_12345",
        "email_address": "[email protected]",
        "verified": False,
        "primary": True,
    })

    assert res is not None

    # Handle response
    print(res)

Parameters

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

Response

models.EmailAddress

Errors

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

get

Returns the details of an email address.

Example Usage

from clerk_backend_api import Clerk

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

    res = clerk.email_addresses.get(email_address_id="email_address_id_example")

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
email_address_id str ✔️ The ID of the email address to retrieve email_address_id_example
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.EmailAddress

Errors

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

delete

Delete the email address with the given ID

Example Usage

from clerk_backend_api import Clerk

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

    res = clerk.email_addresses.delete(email_address_id="email_address_id_example")

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
email_address_id str ✔️ The ID of the email address to delete email_address_id_example
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.DeletedObject

Errors

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

update

Updates an email address.

Example Usage

from clerk_backend_api import Clerk

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

    res = clerk.email_addresses.update(email_address_id="email_address_id_example", verified=False, primary=True)

    assert res is not None

    # Handle response
    print(res)

Parameters

Parameter Type Required Description Example
email_address_id str ✔️ The ID of the email address to update email_address_id_example
verified OptionalNullable[bool] The email address will be marked as verified. false
primary OptionalNullable[bool] Set this email address as the primary email address for the user. true
retries Optional[utils.RetryConfig] Configuration to override the default retry behavior of the client.

Response

models.EmailAddress

Errors

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