Loading...
    • Developer Guide
    • API Reference
    • MCP
    • Resources
    • Release Notes
    Search...
    ⌘K
    Using the API
    API overviewBeta headersErrors
    Messages
    Create a Message
    Count tokens in a Message
    Models
    List Models
    Get a Model
    Beta
    Admin
    Completions
    Create a Text Completion
    Support & configuration
    Rate limitsService tiersVersionsIP addressesSupported regionsOpenAI SDK compatibility
    Console
    Log in

    Admin

    AdminOrganizations

    Get Current Organization
    admin.organizations.me() -> Organization
    GET/v1/organizations/me
    ModelsExpand Collapse
    class Organization: …
    id: str

    ID of the Organization.

    name: str

    Name of the Organization.

    type: Literal["organization"]

    Object type.

    For Organizations, this is always "organization".

    AdminInvites

    Create Invite
    admin.invites.create(InviteCreateParams**kwargs) -> Invite
    POST/v1/organizations/invites
    Get Invite
    admin.invites.retrieve(strinvite_id) -> Invite
    GET/v1/organizations/invites/{invite_id}
    List Invites
    admin.invites.list(InviteListParams**kwargs) -> SyncPage[Invite]
    GET/v1/organizations/invites
    Delete Invite
    admin.invites.delete(strinvite_id) -> InviteDeleteResponse
    DELETE/v1/organizations/invites/{invite_id}
    ModelsExpand Collapse
    class Invite: …
    id: str

    ID of the Invite.

    email: str

    Email of the User being invited.

    expires_at: datetime

    RFC 3339 datetime string indicating when the Invite expires.

    invited_at: datetime

    RFC 3339 datetime string indicating when the Invite was created.

    role: Literal["user", "developer", "billing", 3 more]

    Organization role of the User.

    Accepts one of the following:
    "user"
    "developer"
    "billing"
    "admin"
    "claude_code_user"
    "managed"
    status: Literal["accepted", "expired", "deleted", "pending"]

    Status of the Invite.

    Accepts one of the following:
    "accepted"
    "expired"
    "deleted"
    "pending"
    type: Literal["invite"]

    Object type.

    For Invites, this is always "invite".

    AdminUsers

    Get User
    admin.users.retrieve(struser_id) -> User
    GET/v1/organizations/users/{user_id}
    List Users
    admin.users.list(UserListParams**kwargs) -> SyncPage[User]
    GET/v1/organizations/users
    Update User
    admin.users.update(struser_id, UserUpdateParams**kwargs) -> User
    POST/v1/organizations/users/{user_id}
    Remove User
    admin.users.delete(struser_id) -> UserDeleteResponse
    DELETE/v1/organizations/users/{user_id}
    ModelsExpand Collapse
    class User: …
    id: str

    ID of the User.

    added_at: datetime

    RFC 3339 datetime string indicating when the User joined the Organization.

    email: str

    Email of the User.

    name: str

    Name of the User.

    role: Literal["user", "developer", "billing", 3 more]

    Organization role of the User.

    Accepts one of the following:
    "user"
    "developer"
    "billing"
    "admin"
    "claude_code_user"
    "managed"
    type: Literal["user"]

    Object type.

    For Users, this is always "user".

    AdminWorkspaces

    Create Workspace
    admin.workspaces.create(WorkspaceCreateParams**kwargs) -> Workspace
    POST/v1/organizations/workspaces
    Get Workspace
    admin.workspaces.retrieve(strworkspace_id) -> Workspace
    GET/v1/organizations/workspaces/{workspace_id}
    List Workspaces
    admin.workspaces.list(WorkspaceListParams**kwargs) -> SyncPage[Workspace]
    GET/v1/organizations/workspaces
    Update Workspace
    admin.workspaces.update(strworkspace_id, WorkspaceUpdateParams**kwargs) -> Workspace
    POST/v1/organizations/workspaces/{workspace_id}
    Archive Workspace
    admin.workspaces.archive(strworkspace_id) -> Workspace
    POST/v1/organizations/workspaces/{workspace_id}/archive

    AdminWorkspacesMembers

    Create Workspace Member
    admin.workspaces.members.create(strworkspace_id, MemberCreateParams**kwargs) -> WorkspaceMember
    POST/v1/organizations/workspaces/{workspace_id}/members
    Get Workspace Member
    admin.workspaces.members.retrieve(struser_id, MemberRetrieveParams**kwargs) -> WorkspaceMember
    GET/v1/organizations/workspaces/{workspace_id}/members/{user_id}
    List Workspace Members
    admin.workspaces.members.list(strworkspace_id, MemberListParams**kwargs) -> SyncPage[WorkspaceMember]
    GET/v1/organizations/workspaces/{workspace_id}/members
    Update Workspace Member
    admin.workspaces.members.update(struser_id, MemberUpdateParams**kwargs) -> WorkspaceMember
    POST/v1/organizations/workspaces/{workspace_id}/members/{user_id}
    Delete Workspace Member
    admin.workspaces.members.delete(struser_id, MemberDeleteParams**kwargs) -> MemberDeleteResponse
    DELETE/v1/organizations/workspaces/{workspace_id}/members/{user_id}
    ModelsExpand Collapse
    class WorkspaceMember: …
    type: Literal["workspace_member"]

    Object type.

    For Workspace Members, this is always "workspace_member".

    user_id: str

    ID of the User.

    workspace_id: str

    ID of the Workspace.

    workspace_role: Literal["workspace_user", "workspace_developer", "workspace_admin", "workspace_billing"]

    Role of the Workspace Member.

    Accepts one of the following:
    "workspace_user"
    "workspace_developer"
    "workspace_admin"
    "workspace_billing"

    AdminAPI Keys

    Get API Key
    admin.api_keys.retrieve(strapi_key_id) -> APIKey
    GET/v1/organizations/api_keys/{api_key_id}
    List API Keys
    admin.api_keys.list(APIKeyListParams**kwargs) -> SyncPage[APIKey]
    GET/v1/organizations/api_keys
    Update API Key
    admin.api_keys.update(strapi_key_id, APIKeyUpdateParams**kwargs) -> APIKey
    POST/v1/organizations/api_keys/{api_key_id}

    AdminUsage Report

    Get Messages Usage Report
    admin.usage_report.retrieve_messages(UsageReportRetrieveMessagesParams**kwargs) -> MessagesUsageReport
    GET/v1/organizations/usage_report/messages
    Get Claude Code Usage Report
    admin.usage_report.retrieve_claude_code(UsageReportRetrieveClaudeCodeParams**kwargs) -> ClaudeCodeUsageReport
    GET/v1/organizations/usage_report/claude_code
    ModelsExpand Collapse
    class ClaudeCodeUsageReport: …
    data: List[Data]

    List of Claude Code usage records for the requested date.

    actor: DataActor

    The user or API key that performed the Claude Code actions.

    Accepts one of the following:
    class DataActorUserActor: …
    email_address: str

    Email address of the user who performed Claude Code actions.

    type: Literal["user_actor"]
    class DataActorAPIActor: …
    api_key_name: str

    Name of the API key used to perform Claude Code actions.

    type: Literal["api_actor"]
    core_metrics: DataCoreMetrics

    Core productivity metrics measuring Claude Code usage and impact.

    commits_by_claude_code: int

    Number of git commits created through Claude Code's commit functionality.

    lines_of_code: DataCoreMetricsLinesOfCode

    Statistics on code changes made through Claude Code.

    added: int

    Total number of lines of code added across all files by Claude Code.

    removed: int

    Total number of lines of code removed across all files by Claude Code.

    num_sessions: int

    Number of distinct Claude Code sessions initiated by this actor.

    pull_requests_by_claude_code: int

    Number of pull requests created through Claude Code's PR functionality.

    customer_type: Literal["api", "subscription"]

    Type of customer account (api for API customers, subscription for Pro/Team customers).

    Accepts one of the following:
    "api"
    "subscription"
    date: datetime

    UTC date for the usage metrics in YYYY-MM-DD format.

    model_breakdown: List[DataModelBreakdown]

    Token usage and cost breakdown by AI model used.

    estimated_cost: DataModelBreakdownEstimatedCost

    Estimated cost for using this model

    amount: int

    Estimated cost amount in minor currency units (e.g., cents for USD).

    currency: str

    Currency code for the estimated cost (e.g., 'USD').

    model: str

    Name of the AI model used for Claude Code interactions.

    tokens: DataModelBreakdownTokens

    Token usage breakdown for this model

    cache_creation: int

    Number of cache creation tokens consumed by this model.

    cache_read: int

    Number of cache read tokens consumed by this model.

    input: int

    Number of input tokens consumed by this model.

    output: int

    Number of output tokens generated by this model.

    organization_id: str

    ID of the organization that owns the Claude Code usage.

    terminal_type: str

    Type of terminal or environment where Claude Code was used.

    tool_actions: Dict[str, DataToolActions]

    Breakdown of tool action acceptance and rejection rates by tool type.

    accepted: int

    Number of tool action proposals that the user accepted.

    rejected: int

    Number of tool action proposals that the user rejected.

    subscription_type: Optional[Literal["enterprise", "team"]]

    Subscription tier for subscription customers. null for API customers.

    Accepts one of the following:
    "enterprise"
    "team"
    has_more: bool

    True if there are more records available beyond the current page.

    next_page: Optional[str]

    Opaque cursor token for fetching the next page of results, or null if no more pages are available.

    class MessagesUsageReport: …
    data: List[Data]
    ending_at: datetime

    End of the time bucket (exclusive) in RFC 3339 format.

    results: List[DataResult]

    List of usage items for this time bucket. There may be multiple items if one or more group_by[] parameters are specified.

    api_key_id: Optional[str]

    ID of the API key used. null if not grouping by API key or for usage in the Anthropic Console.

    cache_creation: DataResultCacheCreation

    The number of input tokens for cache creation.

    ephemeral_1h_input_tokens: int

    The number of input tokens used to create the 1 hour cache entry.

    ephemeral_5m_input_tokens: int

    The number of input tokens used to create the 5 minute cache entry.

    cache_read_input_tokens: int

    The number of input tokens read from the cache.

    context_window: Optional[Literal["0-200k", "200k-1M"]]

    Context window used. null if not grouping by context window.

    Accepts one of the following:
    "0-200k"
    "200k-1M"
    inference_geo: Optional[str]

    Inference geo used matching requests' inference_geo parameter if set, otherwise the workspace's default_inference_geo. For models that do not support specifying inference_geo the value is "not_available". Always null if not grouping by inference geo.

    model: Optional[str]

    Model used. null if not grouping by model.

    output_tokens: int

    The number of output tokens generated.

    server_tool_use: DataResultServerToolUse

    Server-side tool usage metrics.

    web_search_requests: int

    The number of web search requests made.

    service_tier: Optional[Literal["standard", "batch", "priority", 3 more]]

    Service tier used. null if not grouping by service tier.

    Accepts one of the following:
    "standard"
    "batch"
    "priority"
    "priority_on_demand"
    "flex"
    "flex_discount"
    speed: Optional[Literal["standard", "fast"]]

    Speed of the usage (research preview). null if not grouping by speed. Only returned when the fast-mode-2026-02-01 beta header is provided.

    Accepts one of the following:
    "standard"
    "fast"
    uncached_input_tokens: int

    The number of uncached input tokens processed.

    workspace_id: Optional[str]

    ID of the Workspace used. null if not grouping by workspace or for the default workspace.

    starting_at: datetime

    Start of the time bucket (inclusive) in RFC 3339 format.

    has_more: bool

    Indicates if there are more results.

    next_page: Optional[datetime]

    Token to provide in as page in the subsequent request to retrieve the next page of data.

    AdminCost Report

    Get Cost Report
    admin.cost_report.retrieve(CostReportRetrieveParams**kwargs) -> CostReport
    GET/v1/organizations/cost_report
    ModelsExpand Collapse
    class CostReport: …
    data: List[Data]
    ending_at: str

    End of the time bucket (exclusive) in RFC 3339 format.

    results: List[DataResult]

    List of cost items for this time bucket. There may be multiple items if one or more group_by[] parameters are specified.

    amount: str

    Cost amount in lowest currency units (e.g. cents) as a decimal string. For example, "123.45" in "USD" represents $1.23.

    context_window: Optional[Literal["0-200k", "200k-1M"]]

    Input context window used. null if not grouping by description or for non-token costs.

    Accepts one of the following:
    "0-200k"
    "200k-1M"
    cost_type: Optional[Literal["tokens", "web_search", "code_execution"]]

    Type of cost. null if not grouping by description.

    Accepts one of the following:
    "tokens"
    "web_search"
    "code_execution"
    currency: str

    Currency code for the cost amount. Currently always "USD".

    description: Optional[str]

    Description of the cost item. null if not grouping by description.

    inference_geo: Optional[str]

    Inference geo used matching requests' inference_geo parameter if set, otherwise the workspace's default_inference_geo. For models that do not support specifying inference_geo the value is "not_available". Always null if not grouping by inference geo.

    model: Optional[str]

    Model name used. null if not grouping by description or for non-token costs.

    service_tier: Optional[Literal["standard", "batch"]]

    Service tier used. null if not grouping by description or for non-token costs.

    Accepts one of the following:
    "standard"
    "batch"
    speed: Optional[Literal["standard", "fast"]]

    Speed used (research preview). null if not grouping by speed, or for non-token costs. Only returned when the fast-mode-2026-02-01 beta header is provided.

    Accepts one of the following:
    "standard"
    "fast"
    token_type: Optional[Literal["uncached_input_tokens", "output_tokens", "cache_read_input_tokens", 2 more]]

    Type of token. null if not grouping by description or for non-token costs.

    Accepts one of the following:
    "uncached_input_tokens"
    "output_tokens"
    "cache_read_input_tokens"
    "cache_creation.ephemeral_1h_input_tokens"
    "cache_creation.ephemeral_5m_input_tokens"
    workspace_id: Optional[str]

    ID of the Workspace this cost is associated with. null if not grouping by workspace or for the default workspace.

    starting_at: str

    Start of the time bucket (inclusive) in RFC 3339 format.

    has_more: bool

    Indicates if there are more results.

    next_page: Optional[datetime]

    Token to provide in as page in the subsequent request to retrieve the next page of data.

    Solutions

    • AI agents
    • Code modernization
    • Coding
    • Customer support
    • Education
    • Financial services
    • Government
    • Life sciences

    Partners

    • Amazon Bedrock
    • Google Cloud's Vertex AI

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Company

    • Anthropic
    • Careers
    • Economic Futures
    • Research
    • News
    • Responsible Scaling Policy
    • Security and compliance
    • Transparency

    Learn

    • Blog
    • Catalog
    • Courses
    • Use cases
    • Connectors
    • Customer stories
    • Engineering at Anthropic
    • Events
    • Powered by Claude
    • Service partners
    • Startups program

    Help and security

    • Availability
    • Status
    • Support
    • Discord

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy