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

# Usage by token

> The same usage figures as `/accounts/usage/`, split by API token instead of totalled for the account.

This is for platforms that hand each of their own customers a separate Generect token. You get, per token: how many requests it made, which endpoints it called, and how many of those succeeded or failed — enough to attribute cost to the customer who caused it, or to spot the one client whose integration is retrying in a loop.

You only ever see your own tokens, never another account's. If you do not pass dates, the report covers the last 30 days.

## Use Case:

If you resell Generect inside your own product, you probably issue one token per customer. This endpoint tells you what each of those tokens actually did, so you can bill the right customer, see who is close to their limit, and catch a broken integration before it shows up on your invoice.

Ask for a single client with `client_id`, or leave it off to get every token at once. Tokens with no traffic in the period are still listed, at zero — useful for spotting a customer who has stopped using you.


## OpenAPI

````yaml get /api/v1/accounts/tokens/analytics/
openapi: 3.0.3
info:
  title: Generect API
  description: >-
    Welcome to the Generect API documentation. Here we will help you integrate
    and use our API.


    API base url: `https://api.generect.com` — every path below is relative to
    this host. Newer endpoints live under `/api/v1/...`, legacy endpoints under
    `/api/...`; use each path exactly as documented.

    Protocol: `HTTPS`


    # Authentication


    Get your API token from the Generect app settings and send it in the
    `Authorization` header with the required `Token` prefix.


    Example: `Authorization: Token xxxxxxxxx`


    # Rate limits


    You can request data depending on your data plan and account balance
    (default: 10000/month). Pricing depends on the operation and the number of
    results returned, and may increase with additional data flags. For exact
    pricing, see each endpoint's Pricing section or your billing settings:
    https://beta.generect.com/settings/billing


    # Note


    _Every endpoint must include the trailing `/`. Requests without the trailing
    slash may fail._
  version: 1.0.0
  contact: {}
servers:
  - url: https://api.generect.com
security:
  - apiKey: []
tags:
  - name: 1. Auth
    description: Login and get user info
  - name: 2. Transactions
    description: List of latest transactions in your account
  - name: 3. Leads
    description: Fetch information about leads by _link/name/ICP_.
  - name: 4. Companies
    description: Fetch information about companies by link/name/ICP.
  - name: 5. Preview
    description: Search masked database leads for preview and reveal workflows.
  - name: 6. Enrich
    description: Enrich leads and companies by internal or external identifiers.
  - name: 7. Email
    description: Find and validate email addresses.
  - name: 8. Accounts
    description: Account profile, usage, and transactions.
  - name: 9. Search
    description: Database and realtime lead, company, and company-lead search.
  - name: 10. Phone
    description: Find phone numbers for leads.
  - name: 11. Webhooks
    description: Register and manage async job notifications.
paths:
  /api/v1/accounts/tokens/analytics/:
    get:
      tags:
        - 8. Accounts
      summary: Usage by token
      description: >-
        The same usage figures as `/accounts/usage/`, split by API token instead
        of totalled for the account.


        This is for platforms that hand each of their own customers a separate
        Generect token. You get, per token: how many requests it made, which
        endpoints it called, and how many of those succeeded or failed — enough
        to attribute cost to the customer who caused it, or to spot the one
        client whose integration is retrying in a loop.


        You only ever see your own tokens, never another account's. If you do
        not pass dates, the report covers the last 30 days.
      parameters:
        - name: client_id
          in: query
          required: false
          description: >-
            Restrict the report to the token carrying this client identifier —
            the value set when the token was created.
          schema:
            type: string
        - name: token
          in: query
          required: false
          description: Restrict the report to one exact token value.
          schema:
            type: string
        - name: start_date
          in: query
          required: false
          description: >-
            Start of the reporting window. Accepts `YYYY-MM-DD` or a full ISO
            timestamp. Defaults to 30 days ago.
          schema:
            type: string
          example: '2026-05-01'
        - name: end_date
          in: query
          required: false
          description: >-
            End of the reporting window, inclusive. Defaults to now. A date with
            no time means midnight, so `end_date=2026-05-31` stops at the very
            start of the 31st and that day's traffic is not counted — pass
            `2026-05-31T23:59:59` (or the 1st of the next month) to include it.
          schema:
            type: string
          example: '2026-05-31T23:59:59'
        - name: timezone
          in: query
          required: false
          description: >-
            IANA timezone used to render the `period` bounds in the response. It
            does not change which requests are counted: the default window is
            anchored to the same instant whichever zone you name. An
            unrecognised name is rejected with 400.
          schema:
            type: string
            default: UTC
          example: Europe/Kyiv
      responses:
        '200':
          description: Per-token usage analytics
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountTokenAnalyticsResponse'
              example:
                data:
                  period:
                    start: '2026-05-01T00:00:00'
                    end: '2026-05-31T23:59:59'
                  total_requests: 1840
                  tokens:
                    - token: 8f14e45fceea167a5a36dedd4bea2543
                      name: Acme Corp
                      client_id: acme-corp
                      is_active: true
                      created_at: '2026-04-02T09:15:00'
                      total_requests: 1200
                      by_endpoint:
                        /api/v1/search/database/leads/: 900
                        /api/v1/email/find/: 300
                      by_status:
                        2xx: 1180
                        4xx: 20
                    - token: c9f0f895fb98ab9159f51fd0297e236d
                      name: Globex
                      client_id: globex
                      is_active: false
                      created_at: '2026-04-18T14:02:00'
                      total_requests: 640
                      by_endpoint:
                        /api/v1/search/realtime/leads/: 640
                      by_status:
                        2xx: 640
        '400':
          description: Invalid timezone or date format.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
components:
  schemas:
    AccountTokenAnalyticsResponse:
      type: object
      properties:
        data:
          type: object
          properties:
            period:
              type: object
              description: >-
                Reporting window the counts were taken over. Timestamps are
                ISO-8601 but carry no UTC offset when explicit `start_date` /
                `end_date` were supplied, so parse them leniently rather than as
                strict RFC 3339.
              properties:
                start:
                  type: string
                end:
                  type: string
            total_requests:
              type: integer
              description: Requests across every token in the window.
            tokens:
              type: array
              description: >-
                One entry per token owned by the account, newest token first. A
                token with no traffic in the window is still listed, with zero
                counts.
              items:
                type: object
                properties:
                  token:
                    type: string
                  name:
                    type: string
                    nullable: true
                    description: >-
                      Label given to the token when it was created. `null` for a
                      token created without one.
                  client_id:
                    type: string
                    nullable: true
                    description: End-client identifier attached to the token.
                  is_active:
                    type: boolean
                    description: >-
                      Whether the token can still authenticate. A revoked token
                      keeps its historical counts.
                  created_at:
                    type: string
                    nullable: true
                    description: ISO-8601, without a UTC offset.
                  total_requests:
                    type: integer
                  by_endpoint:
                    type: object
                    description: Request count keyed by the path that was called.
                    additionalProperties:
                      type: integer
                  by_status:
                    type: object
                    description: >-
                      Request count keyed by HTTP status class, for example
                      `2xx`, `4xx` or `5xx`.
                    additionalProperties:
                      type: integer
    Error:
      type: object
      description: Standard error envelope returned for 4xx/5xx responses.
      properties:
        status:
          type: string
          example: error
        status_code:
          type: integer
          example: 400
        detail:
          description: >-
            Human-readable message (string) for most errors, or a field-level
            validation map ({ field: [messages] }) for 400 validation errors.
          example: Insufficient funds in the account.
  responses:
    Unauthorized:
      description: Missing or invalid API token.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: error
            status_code: 401
            detail: Authentication credentials were not provided.
    Forbidden:
      description: Authenticated, but the account/plan is not allowed to use this endpoint.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            status: error
            status_code: 403
            detail: You do not have permission to perform this action.
  securitySchemes:
    apiKey:
      type: apiKey
      in: header
      name: Authorization
      description: 'Use the required Token prefix. Example: Authorization: Token xxxxxxxxx'

````