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

# Get metric history for a company

> Time series of one metric for one company (oldest first). Returns an empty list if the company is accessible but the key has no data. Requires the `metrics:read` scope and an approved data-access grant from the company. Returns 404 with code `company_not_found` when the company is outside the key's portfolio.




## OpenAPI

````yaml /openapi.yaml get /v1/companies/{id}/metrics/{key}/history
openapi: 3.1.0
info:
  title: Vein Public API
  version: 1.0.0
  description: >
    Phase 1 of the Vein public API. Read-only access to verified portfolio
    company data with full source attribution. See PHASE_1_DESIGN.md.
servers:
  - url: https://api.vein.finance
    description: >-
      Production (key selects live vs test via vein_sk_live_/vein_sk_test_
      prefix)
security:
  - bearerAuth: []
paths:
  /v1/companies/{id}/metrics/{key}/history:
    get:
      summary: Get metric history for a company
      description: >
        Time series of one metric for one company (oldest first). Returns an
        empty list if the company is accessible but the key has no data.
        Requires the `metrics:read` scope and an approved data-access grant from
        the company. Returns 404 with code `company_not_found` when the company
        is outside the key's portfolio.
      operationId: listCompanyMetricHistory
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: The portfolio company id.
        - name: key
          in: path
          required: true
          schema:
            type: string
          description: The metric key, e.g. cash_balance, headcount, burn_rate.
      responses:
        '200':
          description: A time-ordered list of metric snapshots (oldest first).
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/ListEnvelope'
                  - type: object
                    properties:
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/Metric'
        '401':
          $ref: '#/components/responses/AuthError'
        '403':
          $ref: '#/components/responses/MetricsPermissionError'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/RateLimit'
        '500':
          $ref: '#/components/responses/ServerError'
components:
  schemas:
    ListEnvelope:
      type: object
      required:
        - object
        - data
        - has_more
        - url
      properties:
        object:
          type: string
          enum:
            - list
        data:
          type: array
          items: {}
        next_cursor:
          type:
            - string
            - 'null'
        has_more:
          type: boolean
        url:
          type: string
    Metric:
      type: object
      required:
        - company_id
        - key
        - label
        - currency
        - period
        - source
        - verification
        - confidence
      properties:
        company_id:
          type: string
          example: startup_acme
        key:
          type: string
          example: cash_balance
        label:
          type: string
          example: Cash Balance
        value:
          type:
            - string
            - 'null'
          description: Display-formatted value.
          example: $357,000
        raw_value:
          type:
            - number
            - 'null'
          example: 357000
        currency:
          type: string
          example: USD
        category:
          type:
            - string
            - 'null'
          example: financial
        period:
          type: string
          format: date
          example: '2026-05-17'
        as_of:
          type:
            - string
            - 'null'
          format: date-time
        source:
          $ref: '#/components/schemas/MetricSource'
        verification:
          $ref: '#/components/schemas/MetricVerification'
        confidence:
          type: string
          enum:
            - high
            - medium
            - low
          example: high
    MetricSource:
      type: object
      required:
        - system
        - method
      description: Where the metric value came from.
      properties:
        system:
          type: string
          example: plaid
          description: >-
            Originating system, e.g. plaid, quickbooks, stripe, gusto,
            calculated, manual.
        method:
          type: string
          enum:
            - api
            - derived
            - manual
          example: api
        last_synced:
          type:
            - string
            - 'null'
          format: date-time
    MetricVerification:
      type: object
      required:
        - verified
        - signed
        - signature
        - public_key_url
      description: >
        Forward-compatibility block for Phase 2. In Phase 1 `signed` is always
        false and `signature`/`public_key_url` are always null; consumers can
        parse the block today and receive real signatures in Phase 2 without
        changing their code.
      properties:
        verified:
          type: boolean
          example: true
        signed:
          type: boolean
          example: false
        signature:
          type:
            - string
            - 'null'
        public_key_url:
          type:
            - string
            - 'null'
    ErrorEnvelope:
      type: object
      required:
        - error
      properties:
        error:
          type: object
          required:
            - type
            - code
            - message
            - documentation_url
          properties:
            type:
              type: string
              enum:
                - authentication_error
                - permission_error
                - invalid_request_error
                - not_found_error
                - rate_limit_error
                - idempotency_error
                - api_error
            code:
              type: string
              example: invalid_api_key
            message:
              type: string
            request_id:
              type: string
            documentation_url:
              type: string
              format: uri
  responses:
    AuthError:
      description: Authentication failed.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    MetricsPermissionError:
      description: >
        Access to this endpoint was denied. Branch on `error.code` to determine
        the reason: `insufficient_scope` means the API key lacks the required
        scope for this endpoint (`metrics:read`, `accounts:read`, or
        `sources:read` depending on the path); `access_required` means no
        data-access grant exists for this company yet (submit `POST
        /v1/access-requests`); `access_pending` means a grant has been requested
        and is awaiting company approval; `access_revoked` means a previously
        approved grant was revoked by the company.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    NotFound:
      description: >
        The requested resource was not found, or is outside the API key's
        portfolio (existence is not disclosed for companies outside scope).
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    RateLimit:
      description: >
        Too many requests. The public API is rate limited per API key. Every
        response (not just 429s) carries the RateLimit-* headers below; on a 429
        the Retry-After header gives the seconds to wait before retrying.
      headers:
        RateLimit-Limit:
          description: Requests allowed per window for this key.
          schema:
            type: integer
            example: 120
        RateLimit-Remaining:
          description: Requests remaining in the current window.
          schema:
            type: integer
            example: 0
        RateLimit-Reset:
          description: Seconds until the current window resets.
          schema:
            type: integer
            example: 42
        Retry-After:
          description: Seconds to wait before retrying (present on 429 only).
          schema:
            type: integer
            example: 42
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
    ServerError:
      description: An unexpected server-side error occurred.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorEnvelope'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: vein_sk
      description: 'Authorization: Bearer vein_sk_live_... or vein_sk_test_...'

````