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

# Push custom metric points

> Stream hourly metric points into a Custom Metrics Push integration. Authenticate with a Clerk organization API key (`ak_*`, subject `org_*`). Session JWTs and user API keys are rejected. Timestamps are truncated to the hour in UTC; the last write for the same metric, hour, and tags wins.



## OpenAPI

````yaml https://app-api.costory.io/docs/openapi.json post /integrations/{id}/metrics/points
openapi: 3.0.0
info:
  title: Costory
  version: '1.0'
  description: API Documentation
servers:
  - url: ''
    description: Production server
security: []
paths:
  /integrations/{id}/metrics/points:
    post:
      tags:
        - Custom Metrics
      summary: Push custom metric points
      description: >-
        Stream hourly metric points into a Custom Metrics Push integration.
        Authenticate with a Clerk organization API key (`ak_*`, subject
        `org_*`). Session JWTs and user API keys are rejected. Timestamps are
        truncated to the hour in UTC; the last write for the same metric, hour,
        and tags wins.
      operationId: pushCustomMetricPoints
      parameters:
        - schema:
            type: string
            description: Custom Metrics Push integration id
          required: true
          description: Custom Metrics Push integration id
          name: id
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                points:
                  type: array
                  items:
                    type: object
                    properties:
                      metric_name:
                        type: string
                        minLength: 1
                        maxLength: 255
                      ts:
                        anyOf:
                          - type: string
                            format: date-time
                          - type: number
                      value:
                        type: number
                      tags:
                        type: object
                        additionalProperties:
                          anyOf:
                            - type: string
                            - type: number
                            - type: boolean
                        default: {}
                    required:
                      - metric_name
                      - ts
                      - value
                  minItems: 1
                  maxItems: 10000
              required:
                - points
            example:
              points:
                - metric_name: orders
                  ts: '2026-09-02T15:37:00Z'
                  value: 42
                  tags:
                    env: prod
      responses:
        '202':
          description: Points accepted for streaming insert
          content:
            application/json:
              schema:
                type: object
                properties:
                  inserted:
                    type: integer
                    minimum: 0
                  truncatedHours:
                    type: integer
                    minimum: 0
                required:
                  - inserted
                  - truncatedHours
        '400':
          description: Invalid points payload
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BadRequest'
        '401':
          description: Missing or non-org Clerk API key
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Unauthorized'
        '404':
          description: Integration not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFound'
      security:
        - bearerAuth: []
components:
  schemas:
    BadRequest:
      type: object
      properties:
        error:
          type: string
          description: Error code
        reason:
          type: string
          description: Human-readable reason
        details:
          description: Additional details
        summary:
          type: string
          description: Optional short summary
      required:
        - error
    Unauthorized:
      type: object
      properties:
        error:
          type: string
          description: Unauthorized error message
      required:
        - error
    NotFound:
      type: object
      properties:
        error:
          type: string
          description: Resource not found error code
      required:
        - error
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT or Clerk ak_* API key
      description: >-
        Send `Authorization: Bearer <credential>` using either a Clerk session
        JWT or a Clerk API key (`ak_*`). API keys may identify a user (`user_*`)
        or organization (`org_*`) principal and are generated in the Clerk
        Dashboard under API keys.

````

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