Skip to content

Latest commit

 

History

History
230 lines (152 loc) · 21.6 KB

File metadata and controls

230 lines (152 loc) · 21.6 KB

Identities

Overview

Available Operations

list

Retrieves a paginated list of identities in your workspace. Use pagination parameters to navigate through large identity lists efficiently.

Example Usage

from orq_ai_sdk import Orq
import os


with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.identities.list(limit=10, search="john", include_metrics=False)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
limit Optional[int] ➖ N/A
starting_after Optional[str] ➖ Cursor for forward pagination. Set to the _id of the last item from
the previous page.
ending_before Optional[str] ➖ Cursor for backward pagination. Set to the _id of the first item from
the previous page.
search Optional[str] ➖ Case-insensitive search text matched against identity profile fields.
filter_by_tags List[str] ➖ Return only identities that have at least one of these tags.
include_metrics Optional[bool] ➖ Include aggregate usage metrics on each returned identity.
sort_by Optional[models.IdentitySortField] ➖ Field used to order the list.
include_budget Optional[bool] ➖ When true, embed each identity's identity-scoped budget (config and
limits only, no live usage) on the returned records. Adds one budget
lookup for the page; omit to skip it.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.ListIdentitiesResponse

Errors

Error Type Status Code Content Type
models.APIDefaultError 4XX, 5XX */*

create

Creates a new identity with a unique external_id. If an identity with the same external_id already exists, the operation will fail.

Example Usage

from orq_ai_sdk import Orq
import os


with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.identities.create(external_id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
external_id str ✔️ Customer-provided stable identifier for this identity. Must be unique
within the workspace.
display_name Optional[str] ➖ Human-readable display name for the identity.
email Optional[str] ➖ Email address associated with the identity.
avatar_url Optional[str] ➖ URL of the identity avatar image.
tags List[str] ➖ Free-form labels used to organize and filter identities.
metadata Dict[str, Any] ➖ Custom JSON metadata stored with the identity.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.CreateIdentityResponse1

Errors

Error Type Status Code Content Type
models.APIDefaultError 4XX, 5XX */*

retrieve

Retrieves detailed information about a specific identity using their identity ID or external ID from your system.

Example Usage

from orq_ai_sdk import Orq
import os


with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.identities.retrieve(id="<id>", include_metrics=False)

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
id str ✔️ Identity ID to retrieve.
include_metrics Optional[bool] ➖ Include aggregate usage metrics on the returned identity.
include_budget Optional[bool] ➖ When true, embed the identity-scoped budget (config and limits only,
no live usage) on the returned record.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.RetrieveIdentityResponse

Errors

Error Type Status Code Content Type
models.APIDefaultError 4XX, 5XX */*

delete

Permanently deletes an identity from your workspace and cleans up associated budget configurations.

Example Usage

from orq_ai_sdk import Orq
import os


with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.identities.delete(id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
id str ✔️ Identity ID to delete.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.DeleteIdentityResponse

Errors

Error Type Status Code Content Type
models.APIDefaultError 4XX, 5XX */*

update

Updates specific fields of an existing identity. Only the fields provided in the request body will be updated.

Example Usage

from orq_ai_sdk import Orq
import os


with Orq(
    api_key=os.getenv("ORQ_API_KEY", ""),
) as orq:

    res = orq.identities.update(id="<id>")

    # Handle response
    print(res)

Parameters

Parameter Type Required Description
id str ✔️ Identity ID to update.
display_name Optional[str] ➖ New display name. Omit to keep the current display name.
email Optional[str] ➖ New email address. Omit to keep the current email.
avatar_url Optional[str] ➖ New avatar image URL. Omit to keep the current avatar URL.
tags List[str] ➖ Replacement tag list. Leave empty to clear tags.
metadata Dict[str, Any] ➖ Replacement custom JSON metadata.
retries Optional[utils.RetryConfig] ➖ Configuration to override the default retry behavior of the client.

Response

models.UpdateIdentityResponse

Errors

Error Type Status Code Content Type
models.APIDefaultError 4XX, 5XX */*