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

# Compare Sync Stats

> Compare recorded aggregate counts between two runs or a production run and a draft test for the same connector.



## OpenAPI

````yaml https://spec.speakeasy.com/conductor-one/conductorone/my-source-with-code-samples post /api/v1/apps/{app_id}/connectors/{connector_id}/sync_diagnostics/compare_stats
openapi: 3.1.0
info:
  description: The C1 API is a HTTP API for managing C1 resources.
  title: C1 API
  version: 0.1.0-alpha
servers:
  - description: The C1 API server for the current tenant.
    url: https://{tenantDomain}.conductor.one
    variables:
      tenantDomain:
        default: example
        description: The domain of the tenant to use for this request.
security:
  - bearerAuth: []
    oauth: []
paths:
  /api/v1/apps/{app_id}/connectors/{connector_id}/sync_diagnostics/compare_stats:
    post:
      tags:
        - Connector Sync Diagnostics
      summary: Compare Sync Stats
      description: >-
        Compare recorded aggregate counts between two runs or a production run
        and a draft test for the same connector.
      operationId: c1.api.app.v1.ConnectorSyncDiagnosticsService.CompareSyncStats
      parameters:
        - in: path
          name: app_id
          required: true
          schema:
            description: Application containing the connector.
            type: string
        - in: path
          name: connector_id
          required: true
          schema:
            description: >-
              Connector whose production runs and draft evidence may be
              compared.
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/c1.api.app.v1.CompareSyncStatsRequestInput'
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/c1.api.app.v1.CompareSyncStatsResponse'
          description: >-
            CompareSyncStatsResponse contains count deltas only, without synced
            records or file access.
      x-codeSamples:
        - lang: go
          label: CompareSyncStats
          source: "package main\n\nimport(\n\t\"context\"\n\t\"github.com/conductorone/conductorone-sdk-go/pkg/models/shared\"\n\tconductoronesdkgo \"github.com/conductorone/conductorone-sdk-go\"\n\t\"github.com/conductorone/conductorone-sdk-go/pkg/models/operations\"\n\t\"log\"\n)\n\nfunc main() {\n    ctx := context.Background()\n\n    s := conductoronesdkgo.New(\n        conductoronesdkgo.WithSecurity(shared.Security{\n            BearerAuth: \"<YOUR_BEARER_TOKEN_HERE>\",\n            Oauth: \"<YOUR_OAUTH_HERE>\",\n        }),\n    )\n\n    res, err := s.ConnectorSyncDiagnostics.CompareSyncStats(ctx, operations.C1APIAppV1ConnectorSyncDiagnosticsServiceCompareSyncStatsRequest{\n        AppID: \"<id>\",\n        ConnectorID: \"<id>\",\n    })\n    if err != nil {\n        log.Fatal(err)\n    }\n    if res.CompareSyncStatsResponse != nil {\n        // handle response\n    }\n}"
components:
  schemas:
    c1.api.app.v1.CompareSyncStatsRequestInput:
      description: >
        CompareSyncStatsRequest selects two runs with recorded aggregate
        statistics.


        This message contains a oneof named right. Only a single field of the
        following list may be set at a time:
          - rightLifecycleId
          - draftTestRun
      properties:
        draftTestRun:
          oneOf:
            - $ref: '#/components/schemas/c1.api.app.v1.DraftSyncTestRunReference'
            - type: 'null'
        leftLifecycleId:
          description: Production lifecycle used as the before side.
          type: string
        rightLifecycleId:
          description: >-
            Production lifecycle used as the after side.

            This field is part of the `right` oneof.

            See the documentation for `c1.api.app.v1.CompareSyncStatsRequest`
            for more details.
          type:
            - string
            - 'null'
      title: Compare Sync Stats Request
      type: object
      x-speakeasy-name-override: CompareSyncStatsRequest
    c1.api.app.v1.CompareSyncStatsResponse:
      description: >-
        CompareSyncStatsResponse contains count deltas only, without synced
        records or file access.
      properties:
        c1zSizeDelta:
          description: >-
            Recorded file-size difference in bytes; this does not provide access
            to the file.
          format: int64
          type: string
        largeDecrease:
          description: Resource types with a large decrease in at least one count category.
          items:
            type: string
          type:
            - array
            - 'null'
        perType:
          description: >-
            Union of resource types from all three count maps, ordered by
            identifier.
          items:
            $ref: '#/components/schemas/c1.api.app.v1.SyncResourceTypeDelta'
          type:
            - array
            - 'null'
        typesAdded:
          description: Resource types present only on the after side.
          items:
            type: string
          type:
            - array
            - 'null'
        typesRemoved:
          description: Resource types present only on the before side.
          items:
            type: string
          type:
            - array
            - 'null'
      title: Compare Sync Stats Response
      type: object
      x-speakeasy-name-override: CompareSyncStatsResponse
    c1.api.app.v1.DraftSyncTestRunReference:
      description: >-
        DraftSyncTestRunReference identifies retained draft-test statistics for
        this connector's installation.
      properties:
        catalogId:
          description: Tenant-authored catalog entry that owns the installation.
          type: string
        revisionId:
          description: Revision used by the draft test.
          type: string
        testRunId:
          description: Draft test run whose execution statistics are requested.
          type: string
      title: Draft Sync Test Run Reference
      type: object
      x-speakeasy-name-override: DraftSyncTestRunReference
    c1.api.app.v1.SyncResourceTypeDelta:
      description: >-
        SyncResourceTypeDelta compares resource, entitlement and grant counts
        for one resource type.
      properties:
        entitlements:
          oneOf:
            - $ref: '#/components/schemas/c1.api.app.v1.SyncCountDelta'
            - type: 'null'
        grants:
          oneOf:
            - $ref: '#/components/schemas/c1.api.app.v1.SyncCountDelta'
            - type: 'null'
        resourceTypeId:
          description: >-
            Connector-defined resource type identifier, not an individual record
            identifier.
          type: string
        resources:
          oneOf:
            - $ref: '#/components/schemas/c1.api.app.v1.SyncCountDelta'
            - type: 'null'
      title: Sync Resource Type Delta
      type: object
      x-speakeasy-name-override: SyncResourceTypeDelta
    c1.api.app.v1.SyncCountDelta:
      description: >-
        SyncCountDelta compares one aggregate count; missing map entries count
        as zero.
      properties:
        after:
          description: Count in the after run.
          format: int64
          type: string
        before:
          description: Count in the before run.
          format: int64
          type: string
        delta:
          description: After count minus before count.
          format: int64
          type: string
        largeDecrease:
          description: True when a positive before count decreases by at least 30 percent.
          type: boolean
      title: Sync Count Delta
      type: object
      x-speakeasy-name-override: SyncCountDelta
  securitySchemes:
    bearerAuth:
      scheme: bearer
      type: http
    oauth:
      description: >-
        This API uses OAuth2 with the Client Credential flow.

        Client Credentials must be sent in the BODY, not the headers.

        For an example of how to implement this, refer to the
        [c1TokenSource.Token()](https://github.com/ConductorOne/conductorone-sdk-go/blob/3375fe7c0126d17e7ec4e711693dee7b791023aa/token_source.go#L101-L187)
        function.
      flows:
        clientCredentials:
          scopes: {}
          tokenUrl: /auth/v1/token
      type: oauth2

````