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

# Update insights

> Enable or disable pull request insight collection. Enabling starts the initial refresh when needed.



## OpenAPI

````yaml https://api.tembo.io/public-api/openapi/public patch /v1/insights
openapi: 3.1.0
info:
  title: Tembo Public API
  description: >-
    Manage agents, sessions, repositories, and organization resources with the
    Tembo API.
  version: 1.0.0
servers:
  - url: https://api.tembo.io
    description: Tembo API
  - url: https://{deployment-origin}/api/public-api
    description: Self-hosted Tembo
    variables:
      deployment-origin:
        default: tembo.example.com
        description: Hostname of your self-hosted Tembo deployment
security: []
paths:
  /v1/insights:
    patch:
      tags:
        - Insights
      summary: Update insights
      description: >-
        Enable or disable pull request insight collection. Enabling starts the
        initial refresh when needed.
      operationId: updateInsight
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                enabled:
                  type: boolean
                  description: >-
                    Enable or disable pull request contribution insight
                    collection. Enabling starts the initial refresh when needed.
              required:
                - enabled
              additionalProperties: false
      responses:
        '200':
          description: Update insights
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type:
                      - string
                      - 'null'
                    format: uuid
                  status:
                    type:
                      - string
                      - 'null'
                    enum:
                      - syncing
                      - ready
                      - failed
                      - null
                  rangeStart:
                    type:
                      - string
                      - 'null'
                    format: date-time
                  rangeEnd:
                    type:
                      - string
                      - 'null'
                    format: date-time
                  lastSyncedAt:
                    type:
                      - string
                      - 'null'
                    format: date-time
                  enabled:
                    type: boolean
                  data:
                    type:
                      - object
                      - 'null'
                    properties:
                      range:
                        type: string
                        enum:
                          - 1d
                          - 7d
                          - 30d
                          - 1y
                      summary:
                        type: object
                        properties:
                          tasksCompleted:
                            type: integer
                          prsCreated:
                            type: integer
                          prsMerged:
                            type: integer
                          modelCostPerPrUsd:
                            type:
                              - number
                              - 'null'
                            description: >-
                              Recorded model cost plus VM compute fees in USD
                              across the organization divided by Tembo-created
                              PRs in the selected sync window. Excludes
                              subscription fees and inference billing markup.
                              Null when there are no PRs or no recorded costs.
                          temboContribution:
                            type: number
                          changes:
                            type: object
                            properties:
                              prsCreated:
                                type:
                                  - number
                                  - 'null'
                              prsMerged:
                                type:
                                  - number
                                  - 'null'
                              tasksCompleted:
                                type:
                                  - number
                                  - 'null'
                              temboContribution:
                                type:
                                  - number
                                  - 'null'
                            required:
                              - prsCreated
                              - prsMerged
                              - tasksCompleted
                              - temboContribution
                            additionalProperties: false
                            description: >-
                              Recent period compared with the previous one. Null
                              when the previous period has no baseline, such as
                              when the organization joined during it.
                        required:
                          - tasksCompleted
                          - prsCreated
                          - prsMerged
                          - modelCostPerPrUsd
                          - temboContribution
                          - changes
                        additionalProperties: false
                      timeSeries:
                        type: array
                        items:
                          type: object
                          properties:
                            month:
                              type: string
                              description: >-
                                Bucket key: YYYY-MM for 1y, YYYY-MM-DD (UTC) for
                                7d and 30d, and an ISO 8601 hour start for 1d.
                            prsWithTembo:
                              type: integer
                            prsWithoutTembo:
                              type: number
                            prsMerged:
                              type: integer
                            prsCreated:
                              type: integer
                            temboContribution:
                              type: number
                          required:
                            - month
                            - prsWithTembo
                            - prsWithoutTembo
                            - prsMerged
                            - prsCreated
                            - temboContribution
                          additionalProperties: false
                    required:
                      - range
                      - summary
                      - timeSeries
                    additionalProperties: false
                required:
                  - id
                  - status
                  - rangeStart
                  - rangeEnd
                  - lastSyncedAt
                  - enabled
                  - data
                additionalProperties: false
        '400':
          description: >-
            Invalid request or missing required organization or user
            information.
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '409':
          description: Insight operation conflicts with its current state
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
        '500':
          description: Insight operation failed
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                required:
                  - error
                additionalProperties: false
      security:
        - apiKey: []
      x-codeSamples:
        - lang: typescript
          label: TypeScript SDK
          source: |
            import Tembo from '@tembo-io/sdk';

            const client = new Tembo();

            const insight = await client.insights.update({
              enabled: false,
            });
        - lang: rust
          label: Rust SDK
          source: >
            use tembo_rs::*;


            let client = Tembo::from_env()?;


            let response =
            client.insights().update(InsightsUpdateBody::new(false)).send().await?;
components:
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer

````

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