Tightly Metrics API

The metrics API from Tightly — 2 operation(s) for metrics.

GitHub OpenAPI

Operations 2

GET /api/v1/metrics The metric dictionary #
POST /api/v1/metrics/query Compile one query from the dictionary and answer with its rows #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/tightly-io:tightly-io-metrics-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

tightly-io-metrics-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  description: 'The public Tightly API. Authenticate with an API key as a bearer token; the key carries the organisation, so no X-Organization-ID header is sent. Every operation below states the scopes a key needs.


    Every response carries two headers, whatever it answers: `X-Request-Id`, the handle on that one call, and `X-Tightly-Region`, the home that served it.


    Every write accepts an optional `Idempotency-Key` request header, any string up to 255 characters. Send the same key twice and the second request is answered with the first one''s status and body instead of writing again, so a client that retried after a timeout ends holding the record''s id rather than creating a second one. Reusing a key with a different body, or while the first request is still running, is refused `409`. A write that failed releases its key. Keys answer for 24 hours and belong to the API key that used them.


    Any operation can answer `503`, and it is about Tightly rather than about the request: a database briefly out of reach, which is what a failover or a full connection pool looks like from outside, or an idempotency store that could not answer. `message.desc` says which, and most carry a `Retry-After` header naming the seconds to wait. Where the sentence says nothing was written, the same request is safe to send again. Otherwise a read is safe to repeat and a write is not certain either way, because the connection was lost in the middle of it: read the object back before sending it a second time. An `Idempotency-Key` does not settle that one, and deliberately: a write that raised releases its key so the retry is a fresh attempt rather than a refusal for the next day. Branch on the status rather than on `code`, which is `POSTGRES_UNAVAILABLE` or `SERVICE_UNAVAILABLE` depending on which seam refused.'
  title: Tightly Metrics API
  version: 2026-11
servers:
- url: https://api.app.tightly.io
security:
- ApiKey: []
tags:
- name: Metrics
paths:
  /api/v1/metrics:
    get:
      description: 'Every metric and dimension the platform defines, each with one sentence saying what it is, how it rolls up, the grain it is held at, the record it is read from, and the day it entered the dictionary.


        One dictionary, four readers: the pages, the trade reports, the warehouse feed and Ask Tightly all resolve a figure through it, so a definition cannot mean one thing on a report head and another in a model. A tenant may rename a metric and may define its own; no tenant may redefine a platform one, which is why this read is the same for every organisation.


        A key that cannot be served yet is LISTED with the reason rather than left out. A reader who cannot find a key concludes Tightly does not hold the idea; a reader who finds it with "landed cost needs a cost layer per receipt, which nothing has written yet" knows what they are waiting for.


        Feed a `key` from here into `run_metric_query` to get the figure itself.


        Scope: `metrics:read`.'
      operationId: get_metric_dictionary
      parameters:
      - $ref: '#/components/parameters/TightlyVersion'
      responses:
        '200':
          content:
            application/json:
              example:
                data:
                  domains:
                  - data_source: Sale orders
                    domain: sales
                    grain: 'One sale order line: a variant sold on one order.'
                    grains:
                    - daily
                    - monthly
                    - weekly
                    label: Sales
                    supports_time_range: true
                  metrics:
                  - data_source:
                    - Sale orders
                    - Sale orders against the merchandise financial plan
                    definition: Sales after discounts and returns, before tax.
                    domains:
                    - data_source: Sale orders
                      domain: sales
                      grain: 'One sale order line: a variant sold on one order.'
                      label: Sales
                      served: true
                      unsupported_reason: null
                    - data_source: Sale orders against the merchandise financial plan
                      domain: sales_plan
                      grain: One month, category and sales channel, carrying the actual and the plan together.
                      label: Sales vs plan
                      served: true
                      unsupported_reason: null
                    format: currency
                    formula: Added up across whatever the answer is broken down by.
                    key: net_sales
                    kind: measure
                    label: Net sales
                    polarity: higher_is_better
                    served: true
                    since: Before this dictionary
                    synonyms:
                    - revenue
                    - sales
                    - turnover
                    - net revenue
                  - data_source:
                    - Stock levels, with the last 52 weeks of trading and the commitment that covers the style
                    definition: Stock on hand valued at what it cost to land, freight and duty included.
                    domains:
                    - data_source: Stock levels, with the last 52 weeks of trading and the commitment that covers the style
                      domain: stock_finance
                      grain: One variant, with its locations added together.
                      label: Stock value and age
                      served: false
                      unsupported_reason: '`stock_value_landed` cannot be answered yet. Every cost in Tightly today is a STANDARD supplier cost with no freight, duty or handling in it, by declaration: landed cost is computed per purchase-order line and never folded into the variant''s cost, because doing so would move every buy envelope. Valuing stock at landed cost needs a cost layer per receipt, which the operations record specifies and nothing has written yet (REC-11). Ask for `stock_value`, which is the same units at standard cost and says so on its basis line.'
                    format: currency
                    formula: Added up across whatever the answer is broken down by.
                    key: stock_value_landed
                    kind: measure
                    label: Stock value (landed)
                    polarity: neutral
                    served: false
                    since: '2026-09-05'
                    synonyms:
                    - landed stock value
                    - stock at landed cost
                    - inventory at landed cost
              schema:
                properties:
                  data:
                    properties:
                      domains:
                        items:
                          properties:
                            data_source:
                              type: string
                            domain:
                              type: string
                            grain:
                              type: string
                            grains:
                              items:
                                type: string
                              type: array
                            label:
                              type: string
                            supports_time_range:
                              type: boolean
                          type: object
                        type: array
                      metrics:
                        items:
                          properties:
                            data_source:
                              items:
                                type: string
                              type: array
                            definition:
                              type: string
                            domains:
                              items:
                                properties:
                                  data_source:
                                    type: string
                                  domain:
                                    type: string
                                  grain:
                                    type: string
                                  label:
                                    type: string
                                  served:
                                    type: boolean
                                  unsupported_reason:
                                    type:
                                    - string
                                    - 'null'
                                type: object
                              type: array
                            format:
                              type: string
                            formula:
                              description: How the figure combines when rows are added together. Measures only.
                              type: string
                            key:
                              type: string
                            kind:
                              enum:
                              - measure
                              - dimension
                              type: string
                            label:
                              type: string
                            polarity:
                              description: Which way is good. Measures only.
                              type: string
                            served:
                              type: boolean
                            since:
                              type: string
                            synonyms:
                              items:
                                type: string
                              type: array
                          type: object
                        type: array
                    type: object
                type: object
          description: The dictionary
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-Tightly-Region:
              $ref: '#/components/headers/X-Tightly-Region'
        '401':
          content:
            application/json:
              example:
                code: key_invalid
                message:
                  code: key_invalid
                  desc: The API key is not valid.
                  doc_url: https://app.tightly.io/docs/api/guides/errors#key_invalid
                  request_id: req_8f3c1d0a6b2e4a519c772e0a4b6d1f83
                  service: UNKNOWN
                  severity: ERROR
              schema:
                properties:
                  code:
                    description: The same stable code as message.code, at the envelope's top level.
                    type: string
                  message:
                    description: severity, service, desc. A keyed refusal also carries code, doc_url and request_id.
                    type: object
                type: object
          description: 'No usable key: malformed, unknown, revoked, expired or stopped. One refusal covers all five, telling a caller which is which maps the surface for them. A request with no Authorization header at all is refused 400 before any key is looked for.

            '
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-Tightly-Region:
              $ref: '#/components/headers/X-Tightly-Region'
        '403':
          content:
            application/json:
              example:
                code: scope_missing
                message:
                  code: scope_missing
                  desc: This key cannot read Metrics.
                  doc_url: https://app.tightly.io/docs/api/guides/errors#scope_missing
                  request_id: req_6d2b7e1490af4c338b0e51d9c7a2e4b6
                  service: UNKNOWN
                  severity: ERROR
              schema:
                properties:
                  code:
                    description: The same stable code as message.code, at the envelope's top level.
                    type: string
                  message:
                    description: severity, service, desc. A keyed refusal also carries code, doc_url and request_id.
                    type: object
                type: object
          description: 'The key may not reach this operation. `scope_missing` when the key does not hold Metrics; `organization_mismatch` when the path names an organisation that is not the key''s; `ip_not_allowed` when the caller''s address is outside the key''s allowlist.

            '
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-Tightly-Region:
              $ref: '#/components/headers/X-Tightly-Region'
        '429':
          $ref: '#/components/responses/RateLimited'
        '503':
          $ref: '#/components/responses/DatabaseUnavailable'
      security:
      - ApiKey: []
      summary: The metric dictionary
      tags:
      - Metrics
      x-tightly-scopes:
      - metrics:read
  /api/v1/metrics/query:
    post:
      description: 'Hand this the query the dictionary describes and it answers with rows, the columns, the formats each figure prints in, the window it actually ran over and the query itself, echoed back.


        A POST THAT WRITES NOTHING, and it costs `metrics:read` for that reason. The body is a question, not a change: the query is a nested object and a URL is the wrong place for one. Every statement it compiles is a SELECT on the read replica, and every value in the body reaches it as a bound parameter. There is no field for a table, a column or a fragment, and an unknown key is refused by name rather than ignored.


        THE FIGURES ARE THE PAGE''S FIGURES. The query is resolved against the same catalog `get_metric_dictionary` publishes and compiled by the same compiler the Sales page reads through, so a warehouse job pulling net sales for a week gets the week the page shows, to the cent.


        `time_range` may be absolute or relative. A relative window is echoed back as it was asked and `resolved_time_range` carries the two dates it ran over, because the rows carry buckets and a bucket is an opening date, not a bound. `computed_as_of` appears where a domain serves derived figures and there is a real stamp to report; a projection with none says nothing rather than inventing "now".


        Send `{"query": {...}}`, or the query object at the top level. Both are read, because the query travels in a `query` field on every answer here and a caller feeding one back should not have to know which spelling to unwrap it into.


        Scope: `metrics:read`.'
      operationId: run_metric_query
      parameters:
      - $ref: '#/components/parameters/TightlyVersion'
      - $ref: '#/components/parameters/IdempotencyKey'
      requestBody:
        content:
          application/json:
            example:
              query:
                dimensions:
                - sales_channel
                domain: sales
                grain: week
                measures:
                - net_sales
                time_range:
                  amount: 12
                  kind: relative
                  unit: week
            schema:
              properties:
                query:
                  description: 'The query. `domain` and `measures` are required; `dimensions`, `grain`, `time_range`, `filters`, `sort`, `limit` and `comparison` are optional. Every key must be one the dictionary names for that domain.

                    '
                  properties:
                    dimensions:
                      items:
                        type: string
                      type: array
                    domain:
                      type: string
                    filters:
                      description: '`{key, operation, value}` triples, on keys the dictionary allows for the domain.'
                      items:
                        type: object
                      type: array
                    grain:
                      description: day, week, month or quarter, where the domain supports a time range.
                      type: string
                    limit:
                      type: integer
                    measures:
                      items:
                        type: string
                      type: array
                    time_range:
                      description: 'Absolute, `{kind: absolute, start, end}` as two ISO dates, or relative, `{kind: relative, unit, amount}`.

                        '
                      type: object
                  type: object
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              example:
                data:
                  columns:
                  - week
                  - sales_channel
                  - net_sales
                  explanation: Net sales by sales channel, by week, over the last twelve weeks.
                  formats:
                    net_sales: currency
                  query:
                    dimensions:
                    - sales_channel
                    domain: sales
                    grain: week
                    measures:
                    - net_sales
                    time_range:
                      amount: 12
                      kind: relative
                      unit: week
                  resolved_time_range:
                    end: '2026-09-05'
                    start: '2026-06-14'
                  row_count: 2
                  rows:
                  - net_sales: 842100.0
                    sales_channel: Online
                    week: '2026-08-30'
                  - net_sales: 342100.0
                    sales_channel: Wholesale
                    week: '2026-08-30'
              schema:
                properties:
                  data:
                    properties:
                      columns:
                        items:
                          type: string
                        type: array
                      computed_as_of:
                        description: When derived figures in the answer were computed. Absent where there is no stamp.
                        type: string
                      explanation:
                        type: string
                      formats:
                        description: The format each column prints in, straight from the catalog.
                        type: object
                      query:
                        description: The question as asked, round-trippable into this operation.
                        type: object
                      resolved_time_range:
                        description: The two absolute dates the statement ran over, on every query that has a window.
                        type:
                        - object
                        - 'null'
                      row_count:
                        type: integer
                      rows:
                        items:
                          type: object
                        type: array
                    type: object
                type: object
          description: The rows, and the question that produced them
          headers:
            X-RateLimit-Limit:
              $ref: '#/components/headers/X-RateLimit-Limit'
            X-RateLimit-Remaining:
              $ref: '#/components/headers/X-RateLimit-Remaining'
            X-RateLimit-Reset:
              $ref: '#/components/headers/X-RateLimit-Reset'
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-Tightly-Region:
              $ref: '#/components/headers/X-Tightly-Region'
        '400':
          content:
            application/json:
              example:
                allowed:
                - net_sales
                - gross_profit
                - units
                detail: gross_margin_landed cannot be measured in the sales domain.
                error: true
                field: measures
                key: gross_margin_landed
          description: 'The query is the caller''s to fix. `field` names the control, `key` the term that was wrong and `allowed` what may go there.

            '
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-Tightly-Region:
              $ref: '#/components/headers/X-Tightly-Region'
        '401':
          content:
            application/json:
              example:
                code: key_invalid
                message:
                  code: key_invalid
                  desc: The API key is not valid.
                  doc_url: https://app.tightly.io/docs/api/guides/errors#key_invalid
                  request_id: req_8f3c1d0a6b2e4a519c772e0a4b6d1f83
                  service: UNKNOWN
                  severity: ERROR
              schema:
                properties:
                  code:
                    description: The same stable code as message.code, at the envelope's top level.
                    type: string
                  message:
                    description: severity, service, desc. A keyed refusal also carries code, doc_url and request_id.
                    type: object
                type: object
          description: 'No usable key: malformed, unknown, revoked, expired or stopped. One refusal covers all five, telling a caller which is which maps the surface for them. A request with no Authorization header at all is refused 400 before any key is looked for.

            '
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-Tightly-Region:
              $ref: '#/components/headers/X-Tightly-Region'
        '403':
          content:
            application/json:
              example:
                code: scope_missing
                message:
                  code: scope_missing
                  desc: This key cannot read Metrics.
                  doc_url: https://app.tightly.io/docs/api/guides/errors#scope_missing
                  request_id: req_6d2b7e1490af4c338b0e51d9c7a2e4b6
                  service: UNKNOWN
                  severity: ERROR
              schema:
                properties:
                  code:
                    description: The same stable code as message.code, at the envelope's top level.
                    type: string
                  message:
                    description: severity, service, desc. A keyed refusal also carries code, doc_url and request_id.
                    type: object
                type: object
          description: 'The key may not reach this operation. `scope_missing` when the key does not hold Metrics; `organization_mismatch` when the path names an organisation that is not the key''s; `ip_not_allowed` when the caller''s address is outside the key''s allowlist.

            '
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-Tightly-Region:
              $ref: '#/components/headers/X-Tightly-Region'
        '429':
          $ref: '#/components/responses/RateLimited'
        '502':
          content:
            application/json:
              example:
                detail: The query is valid and could not be run. This is a fault on Tightly's side rather than a problem with the request; retrying is safe.
                error: true
          description: The query was valid and the database would not answer it. Ours to fix, not the caller's.
          headers:
            X-Request-Id:
              $ref: '#/components/headers/X-Request-Id'
            X-Tightly-Region:
              $ref: '#/components/headers/X-Tightly-Region'
        '503':
          $ref: '#/components/responses/DatabaseUnavailable'
      security:
      - ApiKey: []
      summary: Compile one query from the dictionary and answer with its rows
      tags:
      - Metrics
      x-tightly-scopes:
      - metrics:read
components:
  responses:
    DatabaseUnavailable:
      content:
        application/json:
          example:
            code: POSTGRES_UNAVAILABLE
            message:
              code: postgres_unavailable
              desc: The database is unavailable right now. Try again in a few seconds.
              doc_url: https://app.tightly.io/docs/api/guides/errors#postgres_unavailable
              request_id: req_2e7b41c0d9384fa6b15c8073ea92d1f4
              service: UNKNOWN
              severity: ERROR
          schema:
            properties:
              code:
                description: The same stable code as message.code, at the envelope's top level.
                type: string
              message:
                description: severity, service, desc, and on a keyed refusal code, doc_url and request_id.
                type: object
            type: object
      description: The database is briefly out of reach, which is what a failover or a full connection pool looks like from outside. Wait the seconds `Retry-After` names and send the request again. A read is safe to repeat. A write is not, because the connection was lost in the middle of it, so read the object back before sending it a second time. Branch on the status rather than on `code`, which is `POSTGRES_UNAVAILABLE` from one of the two seams that raise this and `SERVICE_UNAVAILABLE` from the other.
      headers:
        Retry-After:
          $ref: '#/components/headers/Retry-After'
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
        X-Tightly-Region:
          $ref: '#/components/headers/X-Tightly-Region'
    RateLimited:
      content:
        application/json:
          example:
            code: rate_limited
            message:
              code: rate_limited
              desc: This key has reached its limit of 600 reads a minute; try again in 12 seconds.
              doc_url: https://app.tightly.io/docs/api/guides/errors#rate_limited
              request_id: req_5c1a9f47b0e34d8f9a2c6e10b3d4f785
              service: UNKNOWN
              severity: ERROR
          schema:
            properties:
              code:
                description: The same stable code as message.code, at the envelope's top level.
                type: string
              message:
                description: severity, service, desc, and on a keyed refusal code, doc_url and request_id.
                type: object
            type: object
      description: The key has spent its allowance for this minute. 600 reads and 120 writes a minute, counted per key, refused calls included. `Retry-After` says how long to wait.
      headers:
        Retry-After:
          $ref: '#/components/headers/Retry-After'
        X-RateLimit-Limit:
          $ref: '#/components/headers/X-RateLimit-Limit'
        X-RateLimit-Remaining:
          $ref: '#/components/headers/X-RateLimit-Remaining'
        X-RateLimit-Reset:
          $ref: '#/components/headers/X-RateLimit-Reset'
        X-Request-Id:
          $ref: '#/components/headers/X-Request-Id'
        X-Tightly-Region:
          $ref: '#/components/headers/X-Tightly-Region'
  parameters:
    IdempotencyKey:
      description: A string of your own, up to 255 characters, that makes this write safe to retry. Send the same key twice and the second request is answered with the first one's status and body instead of writing again, so a client that retried after a timeout ends holding the record's id rather than creating a second one. Reusing a key with a different body, or while the first request is still running, is refused `409`. A write that failed releases its key. Keys answer for 24 hours and belong to the API key that used them. A key longer than 255 characters is ignored and the write goes ahead without the guarantee.
      in: header
      name: Idempotency-Key
      required: false
      schema:
        examples:
        - b8f1c0d2-6a4e-4f39-9c21-0d5f2e7a1b44
        maxLength: 255
        type: string
    TightlyVersion:
      description: The date train to answer on. One train exists today, `2026-11`, the one this reference describes and the one every key is minted on, so the call answers on it with or without this header. Send it anyway, so a client built now names its train from the start.
      in: header
      name: Tightly-Version
      required: false
      schema:
        examples:
        - 2026-11
        type: string
  headers:
    X-RateLimit-Reset:
      description: Unix seconds. The moment the allowance is whole again.
      schema:
        examples:
        - 1793491260
        type: integer
    X-Tightly-Region:
      description: The home that served the call. `us` for every organisation today.
      schema:
        examples:
        - us
        type: string
    Retry-After:
      description: Seconds to wait before sending the request again.
      schema:
        examples:
        - 12
        type: integer
    X-Request-Id:
      description: The handle on this one call. Quote it in a support conversation, or find the call by it in the key's Usage.
      schema:
        examples:
        - req_8f3c1d0a6b2e4a519c772e0a4b6d1f83
        type: string
    X-RateLimit-Limit:
      description: The ceiling on the allowance this call spent, per key, per minute. Reads and writes are counted apart, so the number moves with the verb.
      schema:
        examples:
        - 600
        type: integer
    X-RateLimit-Remaining:
      description: What is left of that allowance, this call included. Never below zero.
      schema:
        examples:
        - 597
        type: integer
  securitySchemes:
    ApiKey:
      description: 'An API key from Settings > Developer > API keys, sent as `Authorization: Bearer tly_live_...`. The key carries the organisation.'
      scheme: bearer
      type: http