> ## Documentation Index
> Fetch the complete documentation index at: https://docs.upsolve.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Project Chat Usage

> Count what one of your embedded users did in chat, per workspace: the questions they asked and the conversations (sessions) they took part in. Find them by the id you gave Upsolve (`externalId`, as sent to embed-token); every match is returned, since one id can name a user in each organization and environment, and `organizationExternalId` or `environment` narrows it. Pass `since` for a period. A builder's Playground tests and copies of other people's conversations are not counted; what they asked to make or change a presentation is. Cost and credits are not reported: credits are charged to the organization as a whole and there is no per-user ledger.



## OpenAPI

````yaml get /v2/api/projects/{projectId}/chat-usage
openapi: 3.1.0
info:
  title: Upsolve API
  version: 1.5.0
servers:
  - url: https://api.upsolve.ai
security: []
tags: []
paths:
  /v2/api/projects/{projectId}/chat-usage:
    get:
      summary: Read one embedded user's chat usage
      description: >-
        Count what one of your embedded users did in chat, per workspace: the
        questions they asked and the conversations (sessions) they took part in.
        Find them by the id you gave Upsolve (`externalId`, as sent to
        embed-token); every match is returned, since one id can name a user in
        each organization and environment, and `organizationExternalId` or
        `environment` narrows it. Pass `since` for a period. A builder's
        Playground tests and copies of other people's conversations are not
        counted; what they asked to make or change a presentation is. Cost and
        credits are not reported: credits are charged to the organization as a
        whole and there is no per-user ledger.
      operationId: GetV2ApiProjectsProjectIdChatUsage
      parameters:
        - name: apiKey
          in: query
          required: false
          description: >-
            Upsolve API key, generated under Account → Developer settings in the
            Upsolve Hub. Keys are user-scoped: pass organizationId alongside the
            key to select which org to act on.
          schema:
            type: string
            minLength: 1
            description: >-
              Upsolve API key, generated under Account → Developer settings in
              the Upsolve Hub. Keys are user-scoped: pass organizationId
              alongside the key to select which org to act on.
            examples:
              - up_embed_************
          examples:
            example1:
              value: up_embed_************
        - name: organizationId
          in: query
          required: false
          description: >-
            Your Upsolve organization's UUID — the org that owns the API key and
            project. This is NOT a project organization: do not pass a value
            registered via /projects/register-organization, and do not pass an
            `externalId` (only `projectOrganizationId` accepts those). Omit it
            when using an org-bound API key — the org is read from the key and
            any value sent here is ignored. Required only for user-scoped API
            keys (created under Account → Developer settings) and for the
            Supabase JWT path, where the org is ambiguous and membership is
            verified against it.
          schema:
            description: >-
              Your Upsolve organization's UUID — the org that owns the API key
              and project. This is NOT a project organization: do not pass a
              value registered via /projects/register-organization, and do not
              pass an `externalId` (only `projectOrganizationId` accepts those).
              Omit it when using an org-bound API key — the org is read from the
              key and any value sent here is ignored. Required only for
              user-scoped API keys (created under Account → Developer settings)
              and for the Supabase JWT path, where the org is ambiguous and
              membership is verified against it.
            examples:
              - 123e4567-e89b-12d3-a456-426614174000
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
          examples:
            example1:
              value: 123e4567-e89b-12d3-a456-426614174000
        - name: projectId
          in: path
          required: true
          description: GET /v2/api/projects/:projectId/chat-usage Parameter
          schema:
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
        - name: externalId
          in: query
          required: true
          description: >-
            Your own id for the person, as you send it in `user.externalId` to
            embed-token or register-user-token. Required: usage is read per
            person.
          schema:
            type: string
            minLength: 1
            maxLength: 256
            description: >-
              Your own id for the person, as you send it in `user.externalId` to
              embed-token or register-user-token. Required: usage is read per
              person.
        - name: organizationExternalId
          in: query
          required: false
          description: >-
            Your own id for the organization the person belongs to
            (`organization.externalId` on embed-token). An external id is unique
            only within one project organization, so the same id can name one
            person in each organization that has them; pass this to read just
            one. Omit it to read every match.
          schema:
            description: >-
              Your own id for the organization the person belongs to
              (`organization.externalId` on embed-token). An external id is
              unique only within one project organization, so the same id can
              name one person in each organization that has them; pass this to
              read just one. Omit it to read every match.
            type: string
            minLength: 1
            maxLength: 256
        - name: environment
          in: query
          required: false
          description: >-
            Only the project users of this environment, e.g. `production` or
            `staging`. Omit it to read them all.
          schema:
            description: >-
              Only the project users of this environment, e.g. `production` or
              `staging`. Omit it to read them all.
            type: string
        - name: since
          in: query
          required: false
          description: >-
            ISO-8601 timestamp. Counts only activity at or after it: a
            conversation started earlier and continued after it counts as a
            session, with just its newer questions. Omit it to count all time.
          schema:
            description: >-
              ISO-8601 timestamp. Counts only activity at or after it: a
              conversation started earlier and continued after it counts as a
              session, with just its newer questions. Omit it to count all time.
            type: string
            format: date-time
            pattern: >-
              ^(?:(?:\d\d[2468][048]|\d\d[13579][26]|\d\d0[48]|[02468][048]00|[13579][26]00)-02-29|\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\d|30)|(?:02)-(?:0[1-9]|1\d|2[0-8])))T(?:(?:[01]\d|2[0-3]):[0-5]\d(?::[0-5]\d(?:\.\d+)?)?(?:Z))$
        - name: workspaceId
          in: query
          required: false
          description: >-
            Only this workspace. Omit it to read every workspace the person has
            chatted in.
          schema:
            description: >-
              Only this workspace. Omit it to read every workspace the person
              has chatted in.
            type: string
            format: uuid
            pattern: >-
              ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
      responses:
        '200':
          description: GET /v2/api/projects/:projectId/chat-usage Positive response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: success
                  data:
                    type: object
                    properties:
                      users:
                        type: array
                        items:
                          type: object
                          properties:
                            projectUserId:
                              type: string
                              format: uuid
                              pattern: >-
                                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
                              description: The person's project user id.
                            externalId:
                              type: string
                              description: Your id for the person, as asked for.
                            name:
                              type: string
                              description: The project user's display name.
                            projectOrganizationId:
                              type:
                                - string
                                - 'null'
                              format: uuid
                              pattern: >-
                                ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
                            environment:
                              type: string
                              description: >-
                                The environment the person is in, e.g.
                                `production`.
                            workspaces:
                              type: array
                              items:
                                type: object
                                properties:
                                  workspaceId:
                                    type: string
                                    format: uuid
                                    pattern: >-
                                      ^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$
                                    description: The workspace the person chatted in.
                                  workspaceName:
                                    type: string
                                    description: >-
                                      The workspace's name, or empty when it has
                                      been deleted.
                                  sessions:
                                    type: integer
                                    minimum: 0
                                    maximum: 9007199254740991
                                    description: >-
                                      Conversations (threads) the person took
                                      part in, within `since` when given.
                                  questions:
                                    type: integer
                                    minimum: 0
                                    maximum: 9007199254740991
                                    description: >-
                                      Messages the person sent, counted as Chat
                                      History's `questions` is. The message the
                                      chat sends for them after they decide an
                                      action card counts too.
                                required:
                                  - workspaceId
                                  - workspaceName
                                  - sessions
                                  - questions
                                additionalProperties: false
                              description: >-
                                One entry per workspace the person has chatted
                                in, by name. Empty for a person who has not
                                chatted (in `since`, when given).
                          required:
                            - projectUserId
                            - externalId
                            - name
                            - projectOrganizationId
                            - environment
                            - workspaces
                          additionalProperties: false
                        description: >-
                          Every project user that has the external id: one per
                          project organization, in each environment it is in.
                          Empty when none has.
                    required:
                      - users
                    additionalProperties: false
                required:
                  - status
                  - data
                additionalProperties: false
        '400':
          description: GET /v2/api/projects/:projectId/chat-usage Negative response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    const: error
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                      code:
                        type: string
                      details:
                        type: object
                        propertyNames:
                          type: string
                        additionalProperties: {}
                    required:
                      - message
                    additionalProperties: false
                required:
                  - status
                  - error
                additionalProperties: false
      security:
        - APIKEY_2: []
components:
  securitySchemes:
    APIKEY_2:
      type: apiKey
      in: query
      name: apiKey

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.