Loading...
    • Developer Guide
    • API Reference
    • MCP
    • Resources
    • Release Notes
    Search...
    ⌘K

    Using the API

    Features overviewClient SDKsBeta headersErrors
    Messages
    Create a Message
    Count tokens in a Message
    Batches
    Create a Message Batch
    Retrieve a Message Batch
    List Message Batches
    Cancel a Message Batch
    Delete a Message Batch
    Retrieve Message Batch results
    Models
    List Models
    Get a Model
    Beta
    Models
    List Models
    Get a Model
    Messages
    Create a Message
    Count tokens in a Message
    Batches
    Create a Message Batch
    Retrieve a Message Batch
    List Message Batches
    Cancel a Message Batch
    Delete a Message Batch
    Retrieve Message Batch results
    Files
    Upload File
    List Files
    Download File
    Get File Metadata
    Delete File
    Skills
    Create Skill
    List Skills
    Get Skill
    Delete Skill
    Versions
    Create Skill Version
    List Skill Versions
    Get Skill Version
    Delete Skill Version
    Admin
    Organizations
    Get Current Organization
    Invites
    Create Invite
    Get Invite
    List Invites
    Delete Invite
    Users
    Get User
    List Users
    Update User
    Remove User
    Workspaces
    Create Workspace
    Get Workspace
    List Workspaces
    Update Workspace
    Archive Workspace
    Members
    Create Workspace Member
    Get Workspace Member
    List Workspace Members
    Update Workspace Member
    Delete Workspace Member
    API Keys
    Get Api Key
    List Api Keys
    Update Api Key
    Usage Report
    Get Messages Usage Report
    Get Claude Code Usage Report
    Cost Report
    Get Cost Report
    Completions
    Create a Text Completion

    Support & configuration

    Rate limitsService tiersVersionsIP addressesSupported regionsOpenAI SDK compatibility
    Console

    Admin

    AdminAPI Keys

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

    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.

    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"
    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.

    formatdate-time

    AdminInvites

    Create Invite
    admin.invites.create(InviteCreateParams**kwargs) -> Invite
    post/v1/organizations/invites
    Delete Invite
    admin.invites.delete(strinvite_id) -> InviteDeleteResponse
    delete/v1/organizations/invites/{invite_id}
    List Invites
    admin.invites.list(InviteListParams**kwargs) -> SyncPage[Invite]
    get/v1/organizations/invites
    Get Invite
    admin.invites.retrieve(strinvite_id) -> Invite
    get/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.

    formatdate-time
    invited_at: datetime

    RFC 3339 datetime string indicating when the Invite was created.

    formatdate-time
    role: Literal["user", "developer", "billing", 2 more]

    Organization role of the User.

    Accepts one of the following:
    "user"
    "developer"
    "billing"
    "admin"
    "claude_code_user"
    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".

    Accepts one of the following:
    "invite"

    AdminOrganizations

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

    ID of the Organization.

    formatuuid
    name: str

    Name of the Organization.

    type: Literal["organization"]

    Object type.

    For Organizations, this is always "organization".

    Accepts one of the following:
    "organization"

    AdminUsage Report

    Get Claude Code Usage Report
    admin.usage_report.retrieve_claude_code(UsageReportRetrieveClaudeCodeParams**kwargs) -> ClaudeCodeUsageReport
    get/v1/organizations/usage_report/claude_code
    Get Messages Usage Report
    admin.usage_report.retrieve_messages(UsageReportRetrieveMessagesParams**kwargs) -> MessagesUsageReport
    get/v1/organizations/usage_report/messages
    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"]
    Accepts one of the following:
    "user_actor"
    class DataActorAPIActor: …
    api_key_name: str

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

    type: Literal["api_actor"]
    Accepts one of the following:
    "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.

    formatdate-time
    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.

    formatdate-time
    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"
    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"
    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.

    formatdate-time
    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.

    formatdate-time

    AdminUsers

    Remove User
    admin.users.delete(struser_id) -> UserDeleteResponse
    delete/v1/organizations/users/{user_id}
    List Users
    admin.users.list(UserListParams**kwargs) -> SyncPage[User]
    get/v1/organizations/users
    Get User
    admin.users.retrieve(struser_id) -> User
    get/v1/organizations/users/{user_id}
    Update User
    admin.users.update(struser_id, UserUpdateParams**kwargs) -> User
    post/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.

    formatdate-time
    email: str

    Email of the User.

    name: str

    Name of the User.

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

    Organization role of the User.

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

    Object type.

    For Users, this is always "user".

    Accepts one of the following:
    "user"

    AdminWorkspaces

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

    AdminWorkspacesMembers

    Create Workspace Member
    admin.workspaces.members.create(strworkspace_id, MemberCreateParams**kwargs) -> WorkspaceMember
    post/v1/organizations/workspaces/{workspace_id}/members
    Delete Workspace Member
    admin.workspaces.members.delete(struser_id, MemberDeleteParams**kwargs) -> MemberDeleteResponse
    delete/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
    Get Workspace Member
    admin.workspaces.members.retrieve(struser_id, MemberRetrieveParams**kwargs) -> WorkspaceMember
    get/v1/organizations/workspaces/{workspace_id}/members/{user_id}
    Update Workspace Member
    admin.workspaces.members.update(struser_id, MemberUpdateParams**kwargs) -> WorkspaceMember
    post/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".

    Accepts one of the following:
    "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"
    © 2025 ANTHROPIC PBC

    Products

    • Claude
    • Claude Code
    • Max plan
    • Team plan
    • Enterprise plan
    • Download app
    • Pricing
    • Log in

    Features

    • Claude and Slack
    • Claude in Excel

    Models

    • Opus
    • Sonnet
    • Haiku

    Solutions

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

    Claude Developer Platform

    • Overview
    • Developer docs
    • Pricing
    • Amazon Bedrock
    • Google Cloud’s Vertex AI
    • Console login

    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

    Help and security

    • Availability
    • Status
    • Support center

    Terms and policies

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

    Products

    • Claude
    • Claude Code
    • Max plan
    • Team plan
    • Enterprise plan
    • Download app
    • Pricing
    • Log in

    Features

    • Claude and Slack
    • Claude in Excel

    Models

    • Opus
    • Sonnet
    • Haiku

    Solutions

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

    Claude Developer Platform

    • Overview
    • Developer docs
    • Pricing
    • Amazon Bedrock
    • Google Cloud’s Vertex AI
    • Console login

    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

    Help and security

    • Availability
    • Status
    • Support center

    Terms and policies

    • Privacy policy
    • Responsible disclosure policy
    • Terms of service: Commercial
    • Terms of service: Consumer
    • Usage policy
    © 2025 ANTHROPIC PBC