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

# Issue a policy

> Accepts an approved quote, for a single shipment or for open cover. The policy comes back unpaid (`status` `0`, `coverage_confirmed` `false`) with a `payment_link`. Send the customer to that page to pay. Once the payment succeeds the policy is issued: it gets its policy number, certificate and tax invoice, and the customer is sent on to your `redirect_url`.

For a single shipment, send in `shipment` whichever of the departure date, the carrier and the invoice number were not on the quote request; the call answers `40033` while any is missing. An open cover needs nothing more than `quote_request_id`.

Calling this again for the same quote before it is paid returns the same policy, updated.



## OpenAPI

````yaml /cargo-api-reference/openapi.json post /policies
openapi: 3.0.1
info:
  title: OpenAPI For Cargo Insurance
  description: >-
    APIs to insure a single shipment or run a marine open cover for your
    customers
  license:
    name: MIT
  version: 1.0.0
servers:
  - url: https://sandbox.yasmina.ai/api/v1/cargo
security:
  - bearerAuth: []
paths:
  /policies:
    post:
      tags:
        - Policies
      summary: Issue a policy
      description: >-
        Accepts an approved quote, for a single shipment or for open cover. The
        policy comes back unpaid (`status` `0`, `coverage_confirmed` `false`)
        with a `payment_link`. Send the customer to that page to pay. Once the
        payment succeeds the policy is issued: it gets its policy number,
        certificate and tax invoice, and the customer is sent on to your
        `redirect_url`.


        For a single shipment, send in `shipment` whichever of the departure
        date, the carrier and the invoice number were not on the quote request;
        the call answers `40033` while any is missing. An open cover needs
        nothing more than `quote_request_id`.


        Calling this again for the same quote before it is paid returns the same
        policy, updated.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                quote_request_id:
                  type: string
                  description: >-
                    The `id` of an approved quote request or open-cover
                    application.
                  format: uuid
                redirect_url:
                  type: string
                  description: >-
                    Where to send the customer after they pay. `policyID`
                    anywhere in it is replaced with the policy's id.
                  format: uri
                shipment:
                  $ref: '#/components/schemas/IssuanceDetails'
              required:
                - quote_request_id
            example:
              quote_request_id: a34af107-128e-4c87-934f-5658d04f5870
              redirect_url: https://partner.example.com/cargo/policies/policyID
              shipment:
                departure_date: '2026-12-03'
                arrival_date: '2026-12-28'
                conveyance:
                  vessel_name: MV Example
                  carrier_name: Bahri Logistics
                  voyage_or_flight_number: V123
                references:
                  bill_of_lading: BL-778812
                  invoice_number: INV-2026-0142
      responses:
        '201':
          description: The policy, waiting to be paid for
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Policy'
              example:
                id: 4
                type: single_shipment
                status: 0
                coverage_confirmed: false
                payment_link: https://sandbox.yasmina.ai/short/Ab3xK9
                price: 5624.9
                start_date: '2026-12-03'
                provider_policy_id: null
                policy_url: null
                invoice_url: null
                purchased_at: null
                redirect_url: https://partner.example.com/cargo/policies/4
                meta_data:
                  type: single_shipment
                  quote:
                    vat: 733.68
                    premium: 4891.22
                    coverage: icc_a
                    currency: USD
                    extensions:
                      - war
                      - strikes
                    total_price: 5624.9
                    valid_until: '2026-12-23'
                    rate_percent: 0.45
                    insured_amount: 289850
                    price_currency: SAR
                    valuation_basis: cif_plus_10
                    insurance_provider: walaa
                    insured_amount_sar: 1086937.5
                    insurance_provider_name: Walaa Cooperative Insurance
                  customer:
                    role: importer
                    address:
                      city: Riyadh
                      street: King Fahd Road
                      country: SA
                      district: Al Olaya
                      postal_code: '16789'
                      building_number: '6789'
                    contact:
                      name: Sara Alharbi
                      email: sara@example.com
                      mobile: '+966500000001'
                    cr_number: '1010456789'
                    legal_name: Sample Trading Company 6789
                    vat_number: '310123456700003'
                    legal_name_ar: شركة التجارة النموذجية 6789
                  shipment:
                    goods:
                      category: electronics
                      quantity: 400
                      packaging: cartons
                      description: Consumer electronics, 400 cartons
                      characteristics:
                        - fragile
                    origin:
                      city: Shanghai
                      country: CN
                    freight: 12000
                    coverage: icc_a
                    currency: USD
                    incoterm: FOB
                    conveyance:
                      vessel_name: MV Example
                      carrier_name: Bahri Logistics
                      voyage_or_flight_number: V123
                    extensions:
                      - war
                      - strikes
                    references:
                      bill_of_lading: BL-778812
                      invoice_number: INV-2026-0142
                    destination:
                      city: Jeddah
                      country: SA
                    other_costs: 1500
                    arrival_date: '2026-12-28'
                    invoice_value: 250000
                    departure_date: '2026-12-03'
                    transport_mode: sea
                  cover_end: '2026-12-28'
                  cover_start: '2026-12-03'
                  customer_id: 2
                  quote_request_id: a34af107-128e-4c87-934f-5658d04f5870
                  insurance_provider: walaa
                created_at: '2026-11-23T08:31:07.000000Z'
                updated_at: '2026-11-23T08:31:07.000000Z'
        '400':
          description: >-
            `40032` when the request is referred or rejected. `40030` when the
            quote is past `valid_until`. `40033` when a single shipment still
            lacks details, listed in `missing_fields`. `40026` when the quote
            was already issued and paid for; `policy_id` is that policy.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                '40026':
                  summary: Already issued
                  value:
                    code: '40026'
                    message: This quote was already issued as policy 4.
                    policy_id: 4
                '40030':
                  summary: Quote expired
                  value:
                    code: '40030'
                    message: This quote expired on 2026-12-23. Ask for a new one.
                '40032':
                  summary: Not approved
                  value:
                    code: '40032'
                    message: >-
                      This request is with an underwriter. Read it again until
                      its status is approved.
                '40033':
                  summary: Details missing
                  value:
                    code: '40033'
                    message: >-
                      The shipment needs these details before it can be issued:
                      departure_date, conveyance.carrier_name,
                      references.invoice_number.
                    missing_fields:
                      - departure_date
                      - conveyance.carrier_name
                      - references.invoice_number
        '401':
          $ref: '#/components/responses/Unauthorized'
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
components:
  schemas:
    IssuanceDetails:
      type: object
      properties:
        departure_date:
          type: string
          description: >-
            The day the shipment leaves, `YYYY-MM-DD`. Needed before a policy
            can be issued.
          format: date
        arrival_date:
          type: string
          description: The day it is expected to arrive, on or after `departure_date`.
          format: date
        conveyance:
          type: object
          properties:
            carrier_name:
              type: string
              description: Who carries the shipment. Needed before a policy can be issued.
            vessel_name:
              type: string
            voyage_or_flight_number:
              type: string
        references:
          type: object
          properties:
            invoice_number:
              type: string
              description: >-
                The commercial invoice the shipment travels under. Needed before
                a policy can be issued.
            bill_of_lading:
              type: string
            airway_bill:
              type: string
            customs_declaration:
              type: string
        beneficiary:
          type: object
          properties:
            name:
              type: string
            address:
              type: string
          description: >-
            Who a claim is paid to, when that is not the customer (a bank, for
            example).
      description: >-
        The shipment details that may be added or corrected when the policy is
        issued. None of them changes the price.
    Policy:
      type: object
      properties:
        id:
          type: integer
        type:
          type: string
          enum:
            - single_shipment
            - open_cover
        status:
          type: integer
          description: '`0` until the policy is paid for and issued, `1` once it is.'
          enum:
            - 0
            - 1
        coverage_confirmed:
          type: boolean
          description: >-
            `true` once the policy is paid for and the insurance company has
            issued it. Treat the cargo as covered only then.
        payment_link:
          type: string
          description: >-
            The page to pay the policy on. Valid for 24 hours and renewed when
            you read the policy; `null` once the policy is issued.
          nullable: true
        price:
          type: number
          description: What is paid, VAT included, in SAR.
        start_date:
          type: string
          format: date
        provider_policy_id:
          type: string
          description: >-
            The insurance company's policy number. `null` until the policy is
            issued.
          nullable: true
        policy_url:
          type: string
          description: The policy certificate (PDF). `null` until the policy is issued.
          nullable: true
        invoice_url:
          type: string
          description: The tax invoice (PDF). `null` until the policy is issued.
          nullable: true
        purchased_at:
          type: string
          format: date-time
          nullable: true
        redirect_url:
          type: string
          nullable: true
        meta_data:
          type: object
          properties:
            type:
              type: string
            insurance_provider:
              type: string
            customer_id:
              type: integer
            quote_request_id:
              type: string
              format: uuid
            customer:
              type: object
              description: The customer as it was when the policy was issued.
            shipment:
              type: object
              description: The shipment covered. On a `single_shipment` policy.
            application:
              type: object
              description: >-
                The application the open cover was written on. On an
                `open_cover` policy.
            quote:
              type: object
              description: The quote the policy was issued from.
            cover_start:
              type: string
              format: date
            cover_end:
              type: string
              format: date
              nullable: true
        declarations:
          type: object
          properties:
            count:
              type: integer
            insured_amount_sar:
              type: number
            premium:
              type: number
          description: >-
            On an `open_cover` policy: the shipments covered under it so far,
            with their total insured amount and premium in SAR.
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    Error:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        details:
          type: object
          description: >-
            On `42201`, the messages for each field that failed, keyed by the
            field's path.
        missing_fields:
          type: array
          description: On `40033`, the shipment details still needed.
          items:
            type: string
        policy_id:
          type: integer
          description: On `40026`, the policy the quote was already issued as.
  responses:
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: '40101'
            message: Unauthenticated
    UnprocessableEntity:
      description: A field is missing or not valid. `details` names each one.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            code: '42201'
            message: >-
              The shipment.goods.description field cannot be empty. (and 1 more
              error)
            details:
              shipment.goods.description:
                - The shipment.goods.description field cannot be empty.
              shipment.goods.category:
                - The selected shipment.goods.category is invalid.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````

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