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

# One preview: where it stands, what it would create and what would fail

> What would fail is grouped by cause; a missing mapping, by mapping, with the rows to fill. `refill_suggested` says mappings are missing: fill them (`POST …/ai-fill`), then preview again.



## OpenAPI

````yaml get /consumers/{consumer_id}/syncs/{syncid}/previews/{preview_id}
openapi: 3.1.0
info:
  title: Chift API
  description: >-
    The Chift API is a universal API giving you access to financial data from
    the software of your clients. It helps software companies to offer native
    integrations to their clients without the effort needed to maintain those
    native integrations. By using the APIs (Accounting, POS, eCommerce) of
    Chift, you connect once and allow your clients to use their software
    packages.
  version: 1.0.0
servers:
  - url: https://api.chift.eu
    description: Chift
security:
  - bearerAuth: []
paths:
  /consumers/{consumer_id}/syncs/{syncid}/previews/{preview_id}:
    get:
      tags:
        - Syncs
      summary: 'One preview: where it stands, what it would create and what would fail'
      description: >-
        What would fail is grouped by cause; a missing mapping, by mapping, with
        the rows to fill. `refill_suggested` says mappings are missing: fill
        them (`POST …/ai-fill`), then preview again.
      operationId: agentic_syncs_get_preview
      parameters:
        - name: consumer_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Consumer Id
        - name: syncid
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Syncid
        - name: preview_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Preview Id
        - name: language
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            description: >-
              ISO 639-1 code of the language of the texts (en, fr, nl, de, es;
              any case), falling back to English. Without it, translation keys.
            title: Language
          description: >-
            ISO 639-1 code of the language of the texts (en, fr, nl, de, es; any
            case), falling back to English. Without it, translation keys.
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Preview'
        '404':
          content:
            application/json:
              examples:
                Sync not found:
                  value:
                    message: The sync does not exist
                    status: error
                Not configured:
                  value:
                    message: The consumer is not configured for this sync
                    status: error
                Preview not found:
                  value:
                    message: The preview does not exist
                    status: error
              schema:
                $ref: '#/components/schemas/ChiftError'
          description: Not Found
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    Preview:
      properties:
        preview_id:
          type: string
          format: uuid
          title: Preview Id
          description: The preview's id.
        status:
          type: string
          enum:
            - pending
            - ready
            - failed
          title: Status
          description: Pending while it is queued or running, then ready or failed.
        started_at:
          type: string
          format: date-time
          title: Started At
          description: When it was asked for.
        finished_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Finished At
          description: When it ended. Null until it does.
        from_date:
          type: string
          format: date
          title: From Date
          description: First day the preview covers.
        to_date:
          type: string
          format: date
          title: To Date
          description: Last day the preview covers.
        error:
          anyOf:
            - type: string
            - type: 'null'
          title: Error
          description: Why it failed. Null unless it did.
        counts:
          items:
            $ref: '#/components/schemas/PreviewCount'
          type: array
          title: Counts
          description: How many objects of each kind it would create.
        issues:
          items:
            $ref: '#/components/schemas/PreviewIssue'
          type: array
          title: Issues
          description: >-
            What would fail, one entry per cause; a missing mapping, one entry
            per mapping.
        refill_suggested:
          type: boolean
          title: Refill Suggested
          description: >-
            Mappings are missing: `POST …/ai-fill` may fill them, then preview
            again.
        missing_accounts:
          items:
            $ref: '#/components/schemas/PreviewMissingAccount'
          type: array
          title: Missing Accounts
          description: >-
            The source accounts the accounting does not have, and what each is
            booked on instead.
        mappings_changed:
          type: boolean
          title: Mappings Changed
          description: >-
            A mapping value of the consumer changed after the preview started:
            preview again to see it.
          default: false
      type: object
      required:
        - preview_id
        - status
        - started_at
        - finished_at
        - from_date
        - to_date
        - error
        - counts
        - issues
        - refill_suggested
      title: Preview
    ChiftError:
      properties:
        message:
          type: string
          title: Message
        status:
          anyOf:
            - type: string
            - type: 'null'
          title: Status
          default: error
        detail:
          anyOf:
            - type: string
            - type: 'null'
          title: Detail
          default: ''
        error_code:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Code
      type: object
      required:
        - message
      title: ChiftError
    HTTPValidationError:
      title: Validation Error
      required:
        - message
      type: object
      properties:
        message:
          title: Message
          type: string
          default: Validation error
        status:
          title: Status
          type: string
          default: error
        detail:
          title: Detail
          type: array
          items:
            $ref: '#/components/schemas/ValidationError'
    PreviewCount:
      properties:
        kind:
          type: string
          title: Kind
          description: What would be created.
          examples:
            - invoice
        invoice_type:
          anyOf:
            - type: string
            - type: 'null'
          title: Invoice Type
          description: >-
            An invoice's type: invoices are counted by type. Null for the other
            kinds.
          examples:
            - supplier_invoice
        title:
          type: string
          title: Title
          description: >-
            Name to show, in the requested language; its translation key without
            one.
          examples:
            - Purchase invoices
        count:
          type: integer
          title: Count
          description: How many.
      type: object
      required:
        - kind
        - title
        - count
      title: PreviewCount
    PreviewIssue:
      properties:
        kind:
          type: string
          title: Kind
          description: What kind of problem it is, and so who acts on it.
          examples:
            - configuration
        code:
          type: string
          title: Code
          description: The error code.
          examples:
            - ERROR_SYNC_MISSING_MAPPING_VALUE
        message:
          type: string
          title: Message
          description: What would fail.
        cause:
          additionalProperties: true
          type: object
          title: Cause
          description: What the objects it holds up have in common.
        source_ids:
          items:
            type: string
          type: array
          title: Source Ids
          description: The source objects it would hold up.
        sources:
          additionalProperties:
            $ref: '#/components/schemas/PreviewSummary'
          type: object
          title: Sources
          description: >-
            What a list shows of each source object it would hold up, by its id,
            for those the sync read.
        mapping_key:
          anyOf:
            - type: string
            - type: 'null'
          title: Mapping Key
          description: >-
            For a missing mapping: the mapping to fill, `GET
            …/mappings/{mapping_key}`.
        mapping_title:
          anyOf:
            - type: string
            - type: 'null'
          title: Mapping Title
          description: 'For a missing mapping: the mapping''s name.'
        source_keys:
          anyOf:
            - items:
                type: string
              type: array
            - type: 'null'
          title: Source Keys
          description: 'For a missing mapping: the rows without a value.'
      type: object
      required:
        - kind
        - code
        - message
        - cause
        - source_ids
      title: PreviewIssue
    PreviewMissingAccount:
      properties:
        number:
          anyOf:
            - type: string
            - type: 'null'
          title: Number
          description: >-
            The source's account, which the accounting does not have. Null when
            it gives none.
        account:
          type: string
          title: Account
          description: The accounting's account it is booked on instead.
        outcome:
          type: string
          enum:
            - created
            - default
          title: Outcome
          description: >-
            `created`: the sync creates it; `default`: it goes to the table's
            default account.
        source_ids:
          items:
            type: string
          type: array
          title: Source Ids
          description: The source objects booked so.
      type: object
      required:
        - number
        - account
        - outcome
        - source_ids
      title: PreviewMissingAccount
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    PreviewSummary:
      properties:
        title:
          anyOf:
            - type: string
            - type: 'null'
          title: Title
          description: Its name or number.
        amount:
          anyOf:
            - type: number
            - type: 'null'
          title: Amount
          description: Its total or amount.
        currency:
          anyOf:
            - type: string
            - type: 'null'
          title: Currency
          description: The amount's currency.
        date:
          anyOf:
            - type: string
              format: date
            - type: 'null'
          title: Date
          description: Its date.
      type: object
      title: PreviewSummary
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        This access token needs to be included in each of your request to the
        Chift API.

````

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