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

# Sync Delivery

<p align="center">
  <img src="https://mintcdn.com/canpeker/ezlmTUGMKwmp_MYx/images/delivery_sync_lucid_flow.svg?fit=max&auto=format&n=ezlmTUGMKwmp_MYx&q=85&s=686005cb9d30c24974bef0a5edd9d7b4" width="1442" height="770" data-path="images/delivery_sync_lucid_flow.svg" />
</p>

**Endpoint specification**

* This endpoint helps Service Provider to map AccessRC delivery with own delivery.

* deliveryId is only required when providerDeliveryId and deliveryId aren't mapped within /api/DeliveryRequest/Sync method. If they are already mapped this field can either be missing from the body, can be empty ("deliveryId:"""), or can be null ("deliveryId:null")

* DELIVERY\_READY\_TO\_COLLECT -> Beneficiary can collect delivery or cash from a Cash pick-up location

* DELIVERY\_COLLECTED -> Beneficiary collected delivery or cash is delivered via iban

* DELIVERY\_PENDING -> Wait step which delivery provider ensures that delivery is collected

* DELIVERY\_REVERTED -> Delivery or cash is reverted

* DELIVERED -> Delivery request is committed to the delivery provider

* FAILED -> Delivery could not be completed by the provider


## OpenAPI

````yaml POST /api/Delivery/Sync
openapi: 3.0.4
info:
  title: ServiceProvider API
  version: v1
servers: []
security:
  - ApiKeyAuth: []
paths:
  /api/Delivery/Sync:
    post:
      tags:
        - Delivery
      requestBody:
        content:
          application/json-patch+json:
            schema:
              $ref: '#/components/schemas/DeliverySyncRequest'
            examples:
              Cash Delivery Sync:
                summary: Example of a cash delivery synchronization request.
                value:
                  deliveryList:
                    - providerDeliveryId: e05b049a-a93a-4b04-af96-5824e0af6684
                      deliveryId: null
                      deliveryAmount: 150
                      deliveryUnit: EUR
                      deliveryVoucherSerialNo: ''
                      deliveryReferenceNo: '66021926'
                      status: DELIVERY_REVERTED
                      providerStatus: Refund
                    - providerDeliveryId: 8a2b16e7-f074-4433-8ef2-ac8d913249f0
                      deliveryId: null
                      deliveryAmount: 200
                      deliveryUnit: EUR
                      deliveryVoucherSerialNo: ''
                      deliveryReferenceNo: '55423654'
                      status: DELIVERY_PENDING
                      providerStatus: Pending
              In-Kind Delivery Sync:
                summary: Example of an in-kind delivery synchronization request.
                value:
                  deliveryList:
                    - providerDeliveryId: e05b049a-a93a-4b04-af96-5824e0af6684
                      deliveryId: null
                      deliveryAmount: 1
                      deliveryUnit: pcs
                      deliveryVoucherSerialNo: 500000650388213UR
                      deliveryReferenceNo: ''
                      status: DELIVERY_COLLECTED
                      providerStatus: Collected
                    - providerDeliveryId: 7cbba01e-df8f-406e-8bcf-8154994a16d4
                      deliveryId: null
                      deliveryAmount: 2
                      deliveryUnit: pcs
                      deliveryVoucherSerialNo: 500000435643513UR
                      deliveryReferenceNo: ''
                      status: DELIVERY_COLLECTED
                      providerStatus: Collected
          application/json:
            schema:
              $ref: '#/components/schemas/DeliverySyncRequest'
            examples:
              Cash Delivery Sync:
                summary: Example of a cash delivery synchronization request.
                value:
                  deliveryList:
                    - providerDeliveryId: e05b049a-a93a-4b04-af96-5824e0af6684
                      deliveryId: null
                      deliveryAmount: 150
                      deliveryUnit: EUR
                      deliveryVoucherSerialNo: ''
                      deliveryReferenceNo: '66021926'
                      status: DELIVERY_REVERTED
                      providerStatus: Refund
                    - providerDeliveryId: 8a2b16e7-f074-4433-8ef2-ac8d913249f0
                      deliveryId: null
                      deliveryAmount: 200
                      deliveryUnit: EUR
                      deliveryVoucherSerialNo: ''
                      deliveryReferenceNo: '55423654'
                      status: DELIVERY_PENDING
                      providerStatus: Pending
              In-Kind Delivery Sync:
                summary: Example of an in-kind delivery synchronization request.
                value:
                  deliveryList:
                    - providerDeliveryId: e05b049a-a93a-4b04-af96-5824e0af6684
                      deliveryId: null
                      deliveryAmount: 1
                      deliveryUnit: pcs
                      deliveryVoucherSerialNo: 500000650388213UR
                      deliveryReferenceNo: ''
                      status: DELIVERY_COLLECTED
                      providerStatus: Collected
                    - providerDeliveryId: 7cbba01e-df8f-406e-8bcf-8154994a16d4
                      deliveryId: null
                      deliveryAmount: 2
                      deliveryUnit: pcs
                      deliveryVoucherSerialNo: 500000435643513UR
                      deliveryReferenceNo: ''
                      status: DELIVERY_COLLECTED
                      providerStatus: Collected
          text/json:
            schema:
              $ref: '#/components/schemas/DeliverySyncRequest'
            examples:
              Cash Delivery Sync:
                summary: Example of a cash delivery synchronization request.
                value:
                  deliveryList:
                    - providerDeliveryId: e05b049a-a93a-4b04-af96-5824e0af6684
                      deliveryId: null
                      deliveryAmount: 150
                      deliveryUnit: EUR
                      deliveryVoucherSerialNo: ''
                      deliveryReferenceNo: '66021926'
                      status: DELIVERY_REVERTED
                      providerStatus: Refund
                    - providerDeliveryId: 8a2b16e7-f074-4433-8ef2-ac8d913249f0
                      deliveryId: null
                      deliveryAmount: 200
                      deliveryUnit: EUR
                      deliveryVoucherSerialNo: ''
                      deliveryReferenceNo: '55423654'
                      status: DELIVERY_PENDING
                      providerStatus: Pending
              In-Kind Delivery Sync:
                summary: Example of an in-kind delivery synchronization request.
                value:
                  deliveryList:
                    - providerDeliveryId: e05b049a-a93a-4b04-af96-5824e0af6684
                      deliveryId: null
                      deliveryAmount: 1
                      deliveryUnit: pcs
                      deliveryVoucherSerialNo: 500000650388213UR
                      deliveryReferenceNo: ''
                      status: DELIVERY_COLLECTED
                      providerStatus: Collected
                    - providerDeliveryId: 7cbba01e-df8f-406e-8bcf-8154994a16d4
                      deliveryId: null
                      deliveryAmount: 2
                      deliveryUnit: pcs
                      deliveryVoucherSerialNo: 500000435643513UR
                      deliveryReferenceNo: ''
                      status: DELIVERY_COLLECTED
                      providerStatus: Collected
          application/*+json:
            schema:
              $ref: '#/components/schemas/DeliverySyncRequest'
            examples:
              Cash Delivery Sync:
                summary: Example of a cash delivery synchronization request.
                value:
                  deliveryList:
                    - providerDeliveryId: e05b049a-a93a-4b04-af96-5824e0af6684
                      deliveryId: null
                      deliveryAmount: 150
                      deliveryUnit: EUR
                      deliveryVoucherSerialNo: ''
                      deliveryReferenceNo: '66021926'
                      status: DELIVERY_REVERTED
                      providerStatus: Refund
                    - providerDeliveryId: 8a2b16e7-f074-4433-8ef2-ac8d913249f0
                      deliveryId: null
                      deliveryAmount: 200
                      deliveryUnit: EUR
                      deliveryVoucherSerialNo: ''
                      deliveryReferenceNo: '55423654'
                      status: DELIVERY_PENDING
                      providerStatus: Pending
              In-Kind Delivery Sync:
                summary: Example of an in-kind delivery synchronization request.
                value:
                  deliveryList:
                    - providerDeliveryId: e05b049a-a93a-4b04-af96-5824e0af6684
                      deliveryId: null
                      deliveryAmount: 1
                      deliveryUnit: pcs
                      deliveryVoucherSerialNo: 500000650388213UR
                      deliveryReferenceNo: ''
                      status: DELIVERY_COLLECTED
                      providerStatus: Collected
                    - providerDeliveryId: 7cbba01e-df8f-406e-8bcf-8154994a16d4
                      deliveryId: null
                      deliveryAmount: 2
                      deliveryUnit: pcs
                      deliveryVoucherSerialNo: 500000435643513UR
                      deliveryReferenceNo: ''
                      status: DELIVERY_COLLECTED
                      providerStatus: Collected
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  Error:
                    type: object
                    properties:
                      Code:
                        type: integer
                        format: int32
                      Type:
                        type: string
                      Message:
                        type: string
                      Title:
                        type: string
                  Data:
                    type: object
                    properties:
                      Error:
                        type: object
                        properties:
                          Code:
                            type: integer
                            format: int32
                          Type:
                            type: string
                          Message:
                            type: string
                          Title:
                            type: string
                      Data:
                        $ref: '#/components/schemas/BaseResponse'
                      Paging:
                        type: object
                        properties:
                          Skip:
                            type: integer
                            format: int32
                          Take:
                            type: integer
                            format: int32
                          Total:
                            type: integer
                            format: int32
                      Token:
                        type: object
              example:
                error: null
                data:
                  message: Deliveries are synced successfully
                  date: '2025-04-04T14:07:49Z'
                status: success
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                type: object
                properties:
                  Error:
                    type: object
                    properties:
                      Code:
                        type: integer
                        format: int32
                      Type:
                        type: string
                      Message:
                        type: string
                      Title:
                        type: string
                  Data:
                    type: object
                    properties:
                      Error:
                        type: object
                        properties:
                          Code:
                            type: integer
                            format: int32
                          Type:
                            type: string
                          Message:
                            type: string
                          Title:
                            type: string
                      Data:
                        $ref: '#/components/schemas/BaseResponse'
                      Paging:
                        type: object
                        properties:
                          Skip:
                            type: integer
                            format: int32
                          Take:
                            type: integer
                            format: int32
                          Total:
                            type: integer
                            format: int32
                      Token:
                        type: object
              example:
                error:
                  guid: 95bd740b-755b-4f95-8549-fa9acfc31a41
                  code: 400
                  type: ValidationError
                  message: >-
                    Invalid request body format. Please check your request
                    format from AccessRC API specifications.
                  title: Invalid Request Body
                data: null
                status: failed
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  Error:
                    type: object
                    properties:
                      Code:
                        type: integer
                        format: int32
                      Type:
                        type: string
                      Message:
                        type: string
                      Title:
                        type: string
                  Data:
                    type: object
                    properties:
                      Error:
                        type: object
                        properties:
                          Code:
                            type: integer
                            format: int32
                          Type:
                            type: string
                          Message:
                            type: string
                          Title:
                            type: string
                      Data:
                        $ref: '#/components/schemas/BaseResponse'
                      Paging:
                        type: object
                        properties:
                          Skip:
                            type: integer
                            format: int32
                          Take:
                            type: integer
                            format: int32
                          Total:
                            type: integer
                            format: int32
                      Token:
                        type: object
              example:
                error:
                  guid: 2c77f4b6-6ff8-4017-8bb8-1d7a5c8e01f3
                  code: 401
                  type: Unauthorized
                  message: null
                  title: API Key is missing
                data: null
                status: failed
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                type: object
                properties:
                  Error:
                    type: object
                    properties:
                      Code:
                        type: integer
                        format: int32
                      Type:
                        type: string
                      Message:
                        type: string
                      Title:
                        type: string
                  Data:
                    type: object
                    properties:
                      Error:
                        type: object
                        properties:
                          Code:
                            type: integer
                            format: int32
                          Type:
                            type: string
                          Message:
                            type: string
                          Title:
                            type: string
                      Data:
                        $ref: '#/components/schemas/BaseResponse'
                      Paging:
                        type: object
                        properties:
                          Skip:
                            type: integer
                            format: int32
                          Take:
                            type: integer
                            format: int32
                          Total:
                            type: integer
                            format: int32
                      Token:
                        type: object
              example:
                error:
                  guid: 2c77f4b6-6ff8-4017-8bb8-1d7a5c8e01f3
                  code: 500
                  type: Exception
                  message: null
                  title: Internal Server Error
                data: null
                status: failed
components:
  schemas:
    DeliverySyncRequest:
      required:
        - deliveryList
      type: object
      properties:
        deliveryList:
          type: array
          items:
            $ref: '#/components/schemas/DeliveryItem'
      additionalProperties: false
    BaseResponse:
      type: object
      properties:
        error:
          $ref: '#/components/schemas/Error'
        data:
          nullable: true
        status:
          type: string
          nullable: true
      additionalProperties: false
    DeliveryItem:
      required:
        - deliveryAmount
        - deliveryUnit
        - providerDeliveryId
        - status
      type: object
      properties:
        providerDeliveryId:
          maxLength: 150
          minLength: 0
          type: string
          description: >-
            Unique identifier (UUID) of the delivery record as provided by the
            external service provider. Used to link AccessRC deliveries with the
            provider’s system.
        deliveryId:
          maxLength: 64
          minLength: 0
          type: string
          description: >-
            Internal AccessRC delivery identifier. May be null if the record has
            not yet been fully linked or synchronized with AccessRC.
          nullable: true
        deliveryAmount:
          type: number
          description: >-
            The total quantity or value delivered to the beneficiary (e.g., cash
            amount, item count).
          format: double
        deliveryUnit:
          maxLength: 64
          minLength: 0
          type: string
          description: >-
            The measurement unit associated with the delivery amount (e.g., USD,
            EUR, PCS, KG).
        deliveryVoucherSerialNo:
          maxLength: 64
          minLength: 0
          type: string
          description: >-
            Unique serial number or voucher code issued for tracking or
            redemption purposes. Used to verify delivery authenticity.
          nullable: true
        deliveryReferenceNo:
          maxLength: 64
          minLength: 0
          type: string
          description: >-
            Optional external reference number for the delivery, typically
            provided by the service provider or financial system.
          nullable: true
        status:
          enum:
            - DRAFT
            - SENT_TO_SERVICE_PROVIDER
            - ACCEPTED_BY_SERVICE_PROVIDER
            - REJECTED_BY_SERVICE_PROVIDER
            - DELIVERY_PENDING
            - DELIVERED
            - DELIVERY_READY_TO_COLLECT
            - DELIVERY_COLLECTED
            - DELIVERY_REVERTED
            - FAILED
          type: string
          description: >-
            Internal AccessRC status representing the delivery’s state in the
            system workflow (e.g., DELIVERY_REVERTED, DELIVERED,
            DELIVERY_COLLECTED, DELIVERY_PENDING).
          example: DRAFT
        providerStatus:
          maxLength: 64
          minLength: 0
          type: string
          description: >-
            Current delivery status as reported by the external provider (e.g.,
            Processing, Completed, Collected).
          nullable: true
      additionalProperties: false
    Error:
      type: object
      properties:
        guid:
          type: string
          nullable: true
        code:
          type: integer
          format: int32
        type:
          type: string
          nullable: true
        message:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
      additionalProperties: false
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: API Key required in `x-api-key` header

````