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

# CRM Sync Delivery Log

> Delivery log of a CRM sync run: one entry per record with its final status (`synced` / `failed` / `pending`), the CRM ids created or updated, the error message when it failed and the number of attempts. Records not consumed yet (run still processing) are reported as `pending`.



## OpenAPI

````yaml GET /trigger/crm-sync/{id}/records
openapi: 3.1.0
info:
  title: OpenAPI Lonescale
  description: A sample API for Lonescale
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://public-api.lonescale.com
security:
  - ApiKeyAuth: []
paths:
  /trigger/crm-sync/{id}/records:
    get:
      description: >-
        Delivery log of a CRM sync run: one entry per record with its final
        status (`synced` / `failed` / `pending`), the CRM ids created or
        updated, the error message when it failed and the number of attempts.
        Records not consumed yet (run still processing) are reported as
        `pending`.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
          description: The run id returned by POST /trigger/crm-sync
      responses:
        '200':
          description: Per-record delivery log
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CrmSyncRunRecords'
        '401':
          description: Invalid or missing authentication credentials
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AuthError'
              example:
                message: Invalid API Key
                error: Unauthorized
                statusCode: 401
        '404':
          description: Run not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                message: Run not found
                error: Not Found
                statusCode: 404
components:
  schemas:
    CrmSyncRunRecords:
      type: object
      properties:
        id:
          type: string
        total:
          type: integer
        records:
          type: array
          items:
            $ref: '#/components/schemas/CrmSyncRecordStatus'
    AuthError:
      required:
        - message
        - error
        - statusCode
      type: object
      properties:
        message:
          type: string
          example: Invalid API Key
        error:
          type: string
          example: Unauthorized
        statusCode:
          type: integer
          example: 401
    Error:
      required:
        - error
        - message
      type: object
      properties:
        error:
          type: integer
          format: int32
        message:
          type: string
    CrmSyncRecordStatus:
      type: object
      properties:
        index:
          type: integer
          description: >-
            Position of the record in the submitted payload (contacts first,
            then companies)
        kind:
          type: string
          enum:
            - contact
            - company
        status:
          type: string
          enum:
            - synced
            - failed
            - pending
        error:
          type: string
          description: Present when status is failed
        attempts:
          type: integer
        crm_contact_id:
          type: string
          description: CRM id of the contact created/updated
        crm_company_id:
          type: string
          description: CRM id of the company created/updated
        finished_at:
          type: string
          format: date-time
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: Provide your API key in the x-api-key header.

````