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

# Create a reconciliation story

> Create a story and attach a chain of reconciliations. The first link must use role `origin` and have no shared_data_stream_id; subsequent links must use role `continuation` and specify the shared data stream linking them to the previous reconciliation.



## OpenAPI

````yaml /openapi.json post /reconciliation_stories
openapi: 3.1.0
info:
  title: End Close API
  description: REST API is used to interact with the End Close platform.
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://api.endclose.com/v1
security:
  - ApiKeyAuth: []
paths:
  /reconciliation_stories:
    post:
      summary: Create a reconciliation story
      description: >-
        Create a story and attach a chain of reconciliations. The first link
        must use role `origin` and have no shared_data_stream_id; subsequent
        links must use role `continuation` and specify the shared data stream
        linking them to the previous reconciliation.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - name
              properties:
                name:
                  type: string
                links:
                  type: array
                  items:
                    type: object
                    required:
                      - reconciliation_id
                      - position
                    properties:
                      reconciliation_id:
                        type: string
                      position:
                        type: integer
                        description: 1-indexed position in the chain
                      role:
                        type: string
                        enum:
                          - origin
                          - continuation
                        default: origin
                      shared_data_stream_id:
                        type: string
                        nullable: true
                        description: Required for continuation links
      responses:
        '201':
          description: Story created
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReconciliationStory'
        '422':
          description: Validation error
components:
  schemas:
    ReconciliationStory:
      type: object
      required:
        - name
      description: >-
        A reconciliation story groups related reconciliations into an ordered
        chain so end-to-end flow can be tracked. Each link points to a
        reconciliation; non-origin links must specify the data stream that
        connects them to the previous reconciliation in the chain.
      properties:
        id:
          type: integer
        name:
          type: string
          description: Human readable name for the story
        created_at:
          type: string
          format: date-time
        links:
          type: array
          description: Ordered list of reconciliations participating in the story
          items:
            $ref: '#/components/schemas/ReconciliationStoryLink'
    ReconciliationStoryLink:
      type: object
      required:
        - reconciliation_id
        - position
        - role
      properties:
        id:
          type: integer
        position:
          type: integer
          description: 1-indexed position in the chain. Must be unique within a story.
        role:
          type: string
          enum:
            - origin
            - continuation
          description: >-
            The first link is the 'origin'. All subsequent links are
            'continuation' and must set shared_data_stream_id.
        reconciliation_id:
          type: integer
          description: The reconciliation this link points to
        reconciliation_name:
          type: string
        shared_data_stream_id:
          type: integer
          nullable: true
          description: >-
            The data stream that connects this link to the previous link in the
            chain. Required for continuation links, null for origin.
        shared_data_stream_name:
          type: string
          nullable: true
        side_a_streams:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
              name:
                type: string
        side_b_streams:
          type: array
          items:
            type: object
            properties:
              id:
                type: integer
              name:
                type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY

````