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

# Create an escrow project

> Creates a new escrow entity (project) for the caller's organisation, optionally with milestones and parties inline. Requires the `escrow` feature to be enabled for the organisation.




## OpenAPI

````yaml /api-reference/external/openapi.yaml post /virtual-accounts/escrow
openapi: 3.0.3
info:
  title: PCX API
  description: >
    The PCX integration API. Every request requires two headers: `Authorization`
    (Bearer JWT for user-facing flows, or the literal string `NONE`) and
    `X-Api-Key` (your API key for server-to-server calls, or the literal string
    `NONE`). Pass `NONE` for whichever header you are not using.
  version: '1.0'
servers:
  - url: https://prod-api.pcxpay.com/v1
    description: Production
  - url: https://devs.pcxpay.com/v1
    description: Development
security: []
tags:
  - name: Payment Initiation
    description: Initiate payments and poll for status
  - name: API Keys
    description: Create and manage API keys for programmatic access
  - name: Webhooks
    description: Register endpoints and receive transaction notifications
  - name: Beneficiaries
    description: Manage payment recipients
  - name: Payments
    description: Initiate and track payments
  - name: Bank Validation
    description: Validate bank accounts before initiating a payment
  - name: Transactions
    description: Query the financial transaction ledger
  - name: Virtual Accounts
    description: Multi-currency virtual account provisioning and fund operations
  - name: Payment Links
    description: Generate shareable payment links for customer checkout
  - name: Escrow
    description: Milestone-based escrow projects, parties, contracts, and funding
paths:
  /virtual-accounts/escrow:
    parameters:
      - $ref: '#/components/parameters/AuthorizationHeader'
      - $ref: '#/components/parameters/XApiKeyHeader'
    post:
      tags:
        - Escrow
      summary: Create an escrow project
      description: >
        Creates a new escrow entity (project) for the caller's organisation,
        optionally with milestones and parties inline. Requires the `escrow`
        feature to be enabled for the organisation.
      operationId: createEscrowEntity
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateEscrowRequest'
      responses:
        '201':
          description: Escrow entity created
          content:
            application/json:
              schema:
                allOf:
                  - $ref: '#/components/schemas/StandardResponse'
                  - type: object
                    properties:
                      data:
                        $ref: '#/components/schemas/EscrowEntity'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '502':
          description: Upstream provider error while provisioning the escrow
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  parameters:
    AuthorizationHeader:
      name: Authorization
      in: header
      required: true
      description: >-
        Bearer JWT for user-facing flows (`Bearer eyJraWQ...`), or the literal
        string `NONE` when authenticating via API key.
      schema:
        type: string
        default: NONE
        example: Bearer eyJraWQ...
    XApiKeyHeader:
      name: X-Api-Key
      in: header
      required: true
      description: >-
        API key for server-to-server flows, or the literal string `NONE` when
        authenticating via JWT.
      schema:
        type: string
        default: NONE
        example: pcx_abc123_xxxx
  schemas:
    CreateEscrowRequest:
      type: object
      required:
        - label
        - org_ref
        - currency
        - total_amount
      properties:
        label:
          type: string
          description: Display name for the escrow project
        org_ref:
          type: string
          minLength: 1
          maxLength: 100
          description: Your own reference for the project
        currency:
          type: string
          description: Currency of the escrow pool
        total_amount:
          type: number
          format: float
          description: Total project amount; must be greater than 0
        milestones:
          type: array
          items:
            $ref: '#/components/schemas/EscrowMilestoneRequest'
          description: Optional milestones to create inline
        parties:
          type: array
          items:
            $ref: '#/components/schemas/EscrowPartyRequest'
          description: Optional parties to register inline
    StandardResponse:
      type: object
      properties:
        status:
          type: string
          enum:
            - success
            - error
          example: success
        message:
          type: string
    EscrowEntity:
      type: object
      properties:
        escrow_id:
          type: string
        org_id:
          type: string
        org_ref:
          type: string
        label:
          type: string
        created_by:
          type: string
        currency:
          type: string
        total_amount:
          type: number
          format: float
        funded_amount:
          type: number
          format: float
        disbursed_amount:
          type: number
          format: float
        status:
          $ref: '#/components/schemas/EscrowStatus'
        created_at:
          type: string
        updated_at:
          type: string
        milestones:
          type: array
          items:
            $ref: '#/components/schemas/EscrowMilestone'
        parties:
          type: array
          items:
            $ref: '#/components/schemas/EscrowParty'
        contracts:
          type: array
          items:
            $ref: '#/components/schemas/EscrowContract'
        payment_links:
          type: array
          items:
            $ref: '#/components/schemas/EscrowPaymentLink'
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
        status:
          type: string
          enum:
            - error
    EscrowMilestoneRequest:
      type: object
      required:
        - label
        - expected_disbursement
      properties:
        label:
          type: string
        expected_disbursement:
          type: number
          format: float
          description: >-
            Amount to be released when the milestone disburses; must be greater
            than 0
        description:
          type: string
        sequence:
          type: integer
          minimum: 1
          description: Position of the milestone within the project
        due_date:
          type: string
    EscrowPartyRequest:
      type: object
      required:
        - party_type
        - label
      properties:
        party_type:
          $ref: '#/components/schemas/EscrowPartyType'
        label:
          type: string
        va_account_number:
          type: string
          description: Virtual account number the party's disbursements are paid to
        user_id:
          type: string
    EscrowStatus:
      type: string
      enum:
        - active
        - completed
        - cancelled
      example: active
    EscrowMilestone:
      type: object
      properties:
        milestone_id:
          type: string
        label:
          type: string
        sequence:
          type: integer
        expected_disbursement:
          type: number
          format: float
        status:
          $ref: '#/components/schemas/EscrowMilestoneStatus'
        disbursed_total:
          type: number
          format: float
        description:
          type: string
          nullable: true
        due_date:
          type: string
          nullable: true
        contract_submitted_at:
          type: string
          nullable: true
        disbursed_at:
          type: string
          nullable: true
        parties:
          type: array
          items:
            $ref: '#/components/schemas/EscrowMilestoneParty'
        funding_status:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/EscrowMilestoneFundingStatus'
          description: Derived on read from the entity's funded pool
        covered_amount:
          type: number
          format: float
          nullable: true
          description: Portion of the expected disbursement covered by the funded pool
    EscrowParty:
      type: object
      properties:
        party_id:
          type: string
        party_type:
          $ref: '#/components/schemas/EscrowPartyType'
        label:
          type: string
        user_id:
          type: string
          nullable: true
        va_account_number:
          type: string
          nullable: true
    EscrowContract:
      type: object
      properties:
        contract_id:
          type: string
        milestone_id:
          type: string
        created_at:
          type: string
        status:
          $ref: '#/components/schemas/EscrowContractStatus'
        contractor_confirmations:
          type: array
          items:
            $ref: '#/components/schemas/EscrowContractorConfirmation'
        client_confirmed_at:
          type: string
          nullable: true
        agency_notes:
          type: string
          nullable: true
        reviewed_at:
          type: string
          nullable: true
        rejection_reason:
          type: string
          nullable: true
    EscrowPaymentLink:
      type: object
      properties:
        link_ref:
          type: string
        label:
          type: string
        amount:
          type: number
          format: float
        status:
          $ref: '#/components/schemas/EscrowPaymentLinkStatus'
        created_at:
          type: string
        escrow_id:
          type: string
          nullable: true
    EscrowPartyType:
      type: string
      enum:
        - contractor
        - agency_commission
        - expense
      example: contractor
    EscrowMilestoneStatus:
      type: string
      enum:
        - pending
        - contract_submitted
        - disbursing
        - disbursed
        - partially_disbursed
      example: pending
    EscrowMilestoneParty:
      type: object
      properties:
        party_id:
          type: string
        split_type:
          $ref: '#/components/schemas/EscrowSplitType'
        split_value:
          type: number
          format: float
    EscrowMilestoneFundingStatus:
      type: string
      enum:
        - unfunded
        - partially_funded
        - funded
      example: funded
    EscrowContractStatus:
      type: string
      enum:
        - pending_review
        - approved
        - rejected
      example: approved
    EscrowContractorConfirmation:
      type: object
      properties:
        party_id:
          type: string
        confirmed_at:
          type: string
    EscrowPaymentLinkStatus:
      type: string
      enum:
        - pending
        - settled
      example: pending
    EscrowSplitType:
      type: string
      enum:
        - percentage
        - fixed
      example: percentage
  responses:
    BadRequest:
      description: Invalid request parameters
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Missing or invalid credentials
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Forbidden:
      description: Insufficient permissions
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'

````