openapi: 3.0.3
info:
  title: 'ABYAN API Documentation'
  description: ''
  version: 1.0.0
servers:
  -
    url: 'https://api-sandbox.abyan.ph'
paths:
  /api/partners/v1/oauth2/token:
    post:
      summary: 'Generate access token'
      operationId: generateAccessToken
      description: "Use this endpoint to generate access token using\nyour client id and client secret"
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'Request was successful.'
                  details:
                    access_token: eyJraWQiOiJJNnYxOTZKVUFncVl...
                    expires_in: 3600
                    token_type: Bearer
                properties:
                  message:
                    type: string
                    example: 'Request was successful.'
                  details:
                    type: object
                    properties:
                      access_token:
                        type: string
                        example: eyJraWQiOiJJNnYxOTZKVUFncVl...
                      expires_in:
                        type: integer
                        example: 3600
                      token_type:
                        type: string
                        example: Bearer
      tags:
        - Authentication
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                grant_type:
                  type: string
                  description: client_credentials.
                  example: client_credentials
                client_id:
                  type: string
                  description: 'Your client id.'
                  example: 6j3mj13bmntioepd0o622ed2g4
                client_secret:
                  type: string
                  description: 'Your client secret.'
                  example: c915on174ls8dq9el5ljuqi696fckntqgqn0k4t1p753ursfrac
                scope:
                  type: string
                  description: 'Your scope.'
                  example: delivery
              required:
                - grant_type
                - client_id
                - client_secret
                - scope
      security: []
  /api/partners/v1/delivery/inquire:
    post:
      summary: 'Inquire delivery order'
      operationId: inquireDeliveryOrder
      description: 'Use this endpoint to inquire deliver order'
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'Request was successful.'
                  details:
                    courier_fee: 150
                properties:
                  message:
                    type: string
                    example: 'Request was successful.'
                  details:
                    type: object
                    properties:
                      courier_fee:
                        type: integer
                        example: 150
      tags:
        - Delivery
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                sender:
                  type: 'Sender Details'
                  description: ''
                  example: ''
                receiver:
                  type: 'Receiver Details'
                  description: ''
                  example: ''
              required:
                - sender
                - receiver
  /api/partners/v1/delivery/create:
    post:
      summary: 'Create delivery order'
      operationId: createDeliveryOrder
      description: 'Use this endpoint to create deliver order'
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'Request was successful.'
                  details:
                    client_reference_number: P143-36EG-DY11
                    reference_number: DLS1724406945
                    status: '02 booked'
                    tracking_url: 'https://delivery.dev.abyan.ph/track/DLS1724406945'
                    waybill_url: 'https://sls-laravel-lto-delivery-api-dev-storage-private.s3.ap-southeast-1.amazonaws.com/waybill/P143-36EG-DY11.pdf'
                properties:
                  message:
                    type: string
                    example: 'Request was successful.'
                  details:
                    type: object
                    properties:
                      client_reference_number:
                        type: string
                        example: P143-36EG-DY11
                      reference_number:
                        type: string
                        example: DLS1724406945
                      status:
                        type: string
                        example: '02 booked'
                      tracking_url:
                        type: string
                        example: 'https://delivery.dev.abyan.ph/track/DLS1724406945'
                      waybill_url:
                        type: string
                        example: 'https://sls-laravel-lto-delivery-api-dev-storage-private.s3.ap-southeast-1.amazonaws.com/waybill/P143-36EG-DY11.pdf'
      tags:
        - Delivery
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                client_reference_number:
                  type: string
                  description: 'The client reference number provided by the partner corresponds to this transaction. Must not be greater than 100 characters. Must not be greater than 100 characters.'
                  example: P143-36EG-DY01
                sender:
                  type: 'Sender Details'
                  description: ''
                  example: ''
                receiver:
                  type: 'Receiver Details'
                  description: ''
                  example: ''
                webhook_url:
                  type: string
                  description: "The partner server's URL that is called for this webhook. Must not be greater than 255 characters."
                  example: 'https://partnersite.com/webhook/notify'
              required:
                - client_reference_number
                - sender
                - receiver
                - webhook_url
  '/api/partners/v1/delivery/status/{reference_number}':
    get:
      summary: 'Check delivery order'
      operationId: checkDeliveryOrder
      description: 'Use this endpoint to check the status of a transaction given a reference number.'
      parameters: []
      responses:
        200:
          description: ''
          content:
            application/json:
              schema:
                type: object
                example:
                  message: 'Request was successful.'
                  details:
                    client_reference_number: P143-36EG-DY11
                    reference_number: DLS1724406945
                    status: '02 booked'
                    tracking_url: 'https://delivery.dev.abyan.ph/track/DLS1724406945'
                    waybill_url: 'https://sls-laravel-lto-delivery-api-dev-storage-private.s3.ap-southeast-1.amazonaws.com/waybill/P143-36EG-DY11.pdf'
                properties:
                  message:
                    type: string
                    example: 'Request was successful.'
                  details:
                    type: object
                    properties:
                      client_reference_number:
                        type: string
                        example: P143-36EG-DY11
                      reference_number:
                        type: string
                        example: DLS1724406945
                      status:
                        type: string
                        example: '02 booked'
                      tracking_url:
                        type: string
                        example: 'https://delivery.dev.abyan.ph/track/DLS1724406945'
                      waybill_url:
                        type: string
                        example: 'https://sls-laravel-lto-delivery-api-dev-storage-private.s3.ap-southeast-1.amazonaws.com/waybill/P143-36EG-DY11.pdf'
      tags:
        - Delivery
    parameters:
      -
        in: path
        name: reference_number
        description: ''
        example: DLS1724406945
        required: true
        schema:
          type: 'Tracking reference number, corresponding to the create order transaction.'
  /api/partners/v1/delivery/notify:
    post:
      summary: 'For Pickup Notification'
      operationId: forPickupNotification
      description: 'Allows partner to notify the system when an item is ready for pickup.'
      parameters: []
      responses:
        204:
          description: ''
      tags:
        - Delivery
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                reference_numbers:
                  type: array
                  description: 'Each reference number within the array. Must be a string.'
                  example:
                    - reprehenderit
                  items:
                    type: string
              required:
                - reference_numbers
  /api/partners/v1/delivery/test-webhook:
    post:
      summary: 'Test Webhook Call'
      operationId: testWebhookCall
      description: 'Allows partner to test the webhook call'
      parameters: []
      responses:
        200:
          description: ''
          content:
            text/plain:
              schema:
                type: string
                example: ''
      tags:
        - Delivery
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                webhook_url:
                  type: string
                  description: "The partner server's URL that is called for this webhook. Must be a valid URL."
                  example: 'https://partnersite.com/webhook/notify'
                payload:
                  type: array
                  description: 'An array of objects, each containing details about a specific transaction or update.'
                  example:
                    -
                      client_reference_number: '12345'
                      reference_number: ABCDE12345
                      status: '30 delivered'
                      tracking_url: 'https://tracking.com/track/ABCDE12345'
                      waybill_url: 'https://waybill.com/waybill/ABCDE12345.pdf'
                    -
                      client_reference_number: '67890'
                      reference_number: FGHIJ67890
                      status: '30 delivered'
                      tracking_url: 'https://tracking.com/track/FGHIJ67890'
                      waybill_url: 'https://waybill.com/waybill/FGHIJ67890.pdf'
                  items:
                    type: object
                    properties:
                      client_reference_number:
                        type: string
                        description: 'A unique identifier provided by the client for each transaction. Must not be greater than 255 characters.'
                        example: '12345'
                      reference_number:
                        type: string
                        description: 'The internal reference number associated with the transaction. Must not be greater than 255 characters.'
                        example: ABCDE12345
                      status:
                        type: string
                        description: 'The current status of the transaction.'
                        example: '30 delivered'
                        enum:
                          - '08 assigned'
                          - '09 received'
                          - '10 not received'
                          - '11 picked up'
                          - '12 not picked up'
                          - '20 out for delivery'
                          - '30 delivered'
                          - '40 not delivered'
                          - '41 return to dispatcher'
                          - '42 return to lto'
                      tracking_url:
                        type: string
                        description: 'The URL where the client can track the shipment.'
                        example: 'https://tracking.com/track/ABCDE12345'
                      waybill_url:
                        type: string
                        description: 'The URL to access the waybill associated with the shipment.'
                        example: 'https://waybill.com/waybill/ABCDE12345.pdf'
                    required:
                      - client_reference_number
                      - reference_number
                      - status
              required:
                - webhook_url
                - payload
tags:
  -
    name: Authentication
    description: ''
  -
    name: Delivery
    description: ''
components:
  securitySchemes:
    default:
      type: http
      scheme: bearer
      description: 'You can retrieve your token by visiting your Authentication dashboard.'
security:
  -
    default: []
