Skip to content

Latest commit

 

History

History
75 lines (57 loc) · 4.43 KB

File metadata and controls

75 lines (57 loc) · 4.43 KB

EmbedTokens

Overview

Available Operations

referrals

Create a referrals embed token for the given partner/tenant. The endpoint first attempts to locate an existing enrollment using the provided tenantId. If no enrollment is found, it resolves the partner by email and creates a new enrollment as needed. This results in an upsert-style flow that guarantees a valid enrollment and returns a usable embed token.

Example Usage

from dub import Dub


with Dub(
    token="DUB_API_KEY",
) as d_client:

    res = d_client.embed_tokens.referrals(request={
        "partner": {
            "email": "Letha_Wuckert2@yahoo.com",
            "link_props": {
                "external_id": "123456",
                "tag_ids": [
                    "clux0rgak00011...",
                ],
                "test_variants": [
                    {
                        "url": "https://example.com/variant-1",
                        "percentage": 50,
                    },
                    {
                        "url": "https://example.com/variant-2",
                        "percentage": 50,
                    },
                ],
            },
        },
    })

    # Handle response
    print(res)

Parameters

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

Response

operations.CreateReferralsEmbedTokenResponseBody

Errors

Error Type Status Code Content Type
errors.BadRequest 400 application/json
errors.Unauthorized 401 application/json
errors.Forbidden 403 application/json
errors.NotFound 404 application/json
errors.Conflict 409 application/json
errors.InviteExpired 410 application/json
errors.UnprocessableEntity 422 application/json
errors.RateLimitExceeded 429 application/json
errors.InternalServerError 500 application/json
errors.SDKError 4XX, 5XX */*