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

# Set an app's instrumentation

> Replaces the app's instrumentation, validated against the spec's policy schema, and publishes it into the app's policy: devices take it at their next fetch. Owners and admins; audited as instrumentation.update.



## OpenAPI

````yaml /api-reference/openapi.json put /orgs/{orgId}/projects/{projectId}/apps/{appId}/instrumentation
openapi: 3.1.0
info:
  title: Apsio API
  version: 0.1.0
  description: >-
    Read API v0: your projects, release health and comparisons, missing symbols,
    issues, sessions, vitals, cohort comparisons, performance (app start,
    screens, hangs, MetricKit) and network endpoints and traces for one project.
    Authenticate with a project token as a bearer token, with an OAuth access
    token from Apsio's authorization server (MCP clients), or, from the console,
    with the session cookie of a member of the project's organization.
servers:
  - url: https://api.apsio.io/v1
security: []
paths:
  /orgs/{orgId}/projects/{projectId}/apps/{appId}/instrumentation:
    put:
      summary: Set an app's instrumentation
      description: >-
        Replaces the app's instrumentation, validated against the spec's policy
        schema, and publishes it into the app's policy: devices take it at their
        next fetch. Owners and admins; audited as instrumentation.update.
      parameters:
        - schema:
            type: string
            pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
            example: 0192f3a4-0000-7000-8000-00000000a001
          required: true
          name: orgId
          in: path
        - schema:
            type: string
            pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
            example: 0192f3a4-0000-7000-8000-00000000a001
          required: true
          name: projectId
          in: path
        - schema:
            type: string
            pattern: ^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$
            example: 0192f3a4-0000-7000-8000-00000000a001
          required: true
          name: appId
          in: path
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                families:
                  type: object
                  properties:
                    summary:
                      $ref: '#/components/schemas/InstrumentationFamily'
                    errors:
                      $ref: '#/components/schemas/InstrumentationFamily'
                    logs:
                      $ref: '#/components/schemas/InstrumentationFamily'
                    spans:
                      $ref: '#/components/schemas/InstrumentationFamily'
                    network:
                      $ref: '#/components/schemas/InstrumentationFamily'
                    metrics:
                      $ref: '#/components/schemas/InstrumentationFamily'
                    replay:
                      $ref: '#/components/schemas/InstrumentationFamily'
                  additionalProperties: false
                  description: A family left out is in always mode.
                retention_hours:
                  type: integer
                  minimum: 1
                  maximum: 168
                cap_bytes:
                  type: integer
                  minimum: 1048576
                  maximum: 20971520
                replay_cap_bytes:
                  type: integer
                  minimum: 0
                  maximum: 10485760
              required:
                - families
      responses:
        '200':
          description: The instrumentation, as published
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AppInstrumentation'
      security:
        - session: []
components:
  schemas:
    InstrumentationFamily:
      type: object
      properties:
        mode:
          type: string
          enum:
            - always
            - sampled
            - on_trigger
            - never
        rate:
          type: number
          minimum: 0
          maximum: 1
        triggers:
          type: array
          items:
            type: string
        window_minutes:
          type: integer
          minimum: 1
          maximum: 60
      required:
        - mode
      description: >-
        A family's mode (spec 15.3): always; sampled at a rate; on_trigger with
        triggers (crash, error, anr, event:<name>) and window_minutes; or never.
        A sampled family may list triggers too: a session outside its sample
        sends the window before a trigger.
    AppInstrumentation:
      type: object
      properties:
        app_id:
          type: string
        families:
          type: object
          properties:
            summary:
              $ref: '#/components/schemas/InstrumentationFamily'
            errors:
              $ref: '#/components/schemas/InstrumentationFamily'
            logs:
              $ref: '#/components/schemas/InstrumentationFamily'
            spans:
              $ref: '#/components/schemas/InstrumentationFamily'
            network:
              $ref: '#/components/schemas/InstrumentationFamily'
            metrics:
              $ref: '#/components/schemas/InstrumentationFamily'
            replay:
              $ref: '#/components/schemas/InstrumentationFamily'
          additionalProperties: false
          description: A family left out is in always mode.
        retention_hours:
          type: integer
          description: 'How long held records stay on the device: 1 to 168 hours.'
        cap_bytes:
          type: integer
          description: 'The store''s cap: at most 20 MiB.'
        replay_cap_bytes:
          type: integer
          description: 'Replay''s share of it: at most 10 MiB.'
        updated_by:
          type:
            - string
            - 'null'
          description: 'Null: the profile''s defaults.'
        updated_at:
          type:
            - string
            - 'null'
      required:
        - app_id
        - families
        - retention_hours
        - cap_bytes
        - replay_cap_bytes
        - updated_by
        - updated_at
  securitySchemes:
    session:
      type: apiKey
      in: cookie
      name: apsio_session
      description: >-
        The console session, set by /v1/auth/callback (`__Host-apsio_session`
        when host-only).

````

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