# Stock arrives — from purchase order to the shelf

How goods enter your business on paper and in fact: you order from a vendor, the order is approved and issued, and when the boxes arrive a receipt records exactly what came in — your stock figures move only when the receipt posts.

Procurement · a guided walk in 4 steps.

## The steps

1. **Raise the purchase order** — The order is the agreement — what you asked the vendor for, at what cost, for which location. — [createPurchaseOrder](/reference/purchasing/createPurchaseOrder/)
2. **Submit, approve, and issue it** — A submitted order goes to review; approval commits the spend; issuing sends it to the vendor — three separate decisions, each recorded. — [submitPurchaseOrder](/reference/purchasing/submitPurchaseOrder/), [approvePurchaseOrder](/reference/document-approvals/approvePurchaseOrder/), [issuePurchaseOrder](/reference/purchasing/issuePurchaseOrder/)
3. **Receive the goods** — The receipt is the arrival record — what actually came, against which order lines. — [createReceipt](/reference/inventory-operations/createReceipt/)
4. **Post the receipt** — Posting moves your stock figures — until then nothing is on hand; a mistaken receipt cancels instead. — [postReceipt](/reference/inventory-operations/postReceipt/)

## The calls

Every operation this use case runs, in the order it first appears, with the request and the response its reference page shows.

### createPurchaseOrder

[createPurchaseOrder](/reference/purchasing/createPurchaseOrder/) — mutation · Create a new purchase order — what you are buying from a supplier at your organization.

**Example request**

```graphql
mutation ExampleCreatePurchaseOrder($input: CreatePurchaseOrderInput!) {
  createPurchaseOrder(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    orgVendorId
    currency
    paymentTerms
    incotermCode
    vendorReference
    notes
    lineCount
    openLineCount
    nextLineNo
    receivingReceiptId
  }
}
```

Variables:

```json
{
  "input": {
    "caption": "Blue jeans",
    "orgVendorId": "01900000-0000-7000-8000-f885fa720000",
    "lines": [
      {
        "variantId": "01900000-0000-7000-8000-8415e73b0000",
        "logicalFacilityId": "01900000-0000-7000-8000-8026f71c0000"
      }
    ]
  }
}
```

Send it with the envelope naming the version: `"extensions": {"at": {"version": {"name":"genesis","number":0}}}`.

**Example response**

```json
{
  "data": {
    "createPurchaseOrder": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "PO-EXMP-0000-000F",
      "type": "PurchaseOrder",
      "caption": "Blue jeans",
      "status": "draft",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "orgVendorId": "01900000-0000-7000-8000-f885fa720000",
      "currency": "USD",
      "paymentTerms": "<payment terms>",
      "incotermCode": "BJ-001",
      "vendorReference": "<vendor reference>",
      "notes": "Restock before the weekend.",
      "lineCount": 1,
      "openLineCount": 1,
      "nextLineNo": 1,
      "receivingReceiptId": "01900000-0000-7000-8000-e3994aee0000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```

### submitPurchaseOrder

[submitPurchaseOrder](/reference/purchasing/submitPurchaseOrder/) — mutation · Send a purchase order to the vendor — the buy commitment goes out.

**Example request**

```graphql
mutation ExampleSubmitPurchaseOrder($id: ID!, $revision: ID!, $reason: String) {
  submitPurchaseOrder(id: $id, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    orgVendorId
    currency
    paymentTerms
    incotermCode
    vendorReference
    notes
    lineCount
    openLineCount
    nextLineNo
    receivingReceiptId
  }
}
```

Variables:

```json
{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "reason": "Correcting a miscount."
}
```

Send it with the envelope naming the version: `"extensions": {"at": {"version": {"name":"genesis","number":0}}}`.

**Example response**

```json
{
  "data": {
    "submitPurchaseOrder": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "PO-EXMP-0000-000F",
      "type": "PurchaseOrder",
      "caption": "Blue jeans",
      "status": "draft",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "orgVendorId": "01900000-0000-7000-8000-f885fa720000",
      "currency": "USD",
      "paymentTerms": "<payment terms>",
      "incotermCode": "BJ-001",
      "vendorReference": "<vendor reference>",
      "notes": "Restock before the weekend.",
      "lineCount": 1,
      "openLineCount": 1,
      "nextLineNo": 1,
      "receivingReceiptId": "01900000-0000-7000-8000-e3994aee0000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```

### approvePurchaseOrder

[approvePurchaseOrder](/reference/document-approvals/approvePurchaseOrder/) — mutation · Approve a purchase order internally so it can be submitted.

**Example request**

```graphql
mutation ExampleApprovePurchaseOrder($id: ID!, $revision: ID!, $reason: String) {
  approvePurchaseOrder(id: $id, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    orgVendorId
    currency
    paymentTerms
    incotermCode
    vendorReference
    notes
    lineCount
    openLineCount
    nextLineNo
    receivingReceiptId
  }
}
```

Variables:

```json
{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "reason": "Correcting a miscount."
}
```

Send it with the envelope naming the version: `"extensions": {"at": {"version": {"name":"genesis","number":0}}}`.

**Example response**

```json
{
  "data": {
    "approvePurchaseOrder": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "PO-EXMP-0000-000F",
      "type": "PurchaseOrder",
      "caption": "Blue jeans",
      "status": "draft",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "orgVendorId": "01900000-0000-7000-8000-f885fa720000",
      "currency": "USD",
      "paymentTerms": "<payment terms>",
      "incotermCode": "BJ-001",
      "vendorReference": "<vendor reference>",
      "notes": "Restock before the weekend.",
      "lineCount": 1,
      "openLineCount": 1,
      "nextLineNo": 1,
      "receivingReceiptId": "01900000-0000-7000-8000-e3994aee0000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```

### issuePurchaseOrder

[issuePurchaseOrder](/reference/purchasing/issuePurchaseOrder/) — mutation · Issue a purchase order — commit it into the buying pipeline.

**Example request**

```graphql
mutation ExampleIssuePurchaseOrder($id: ID!, $revision: ID!, $reason: String) {
  issuePurchaseOrder(id: $id, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    orgVendorId
    currency
    paymentTerms
    incotermCode
    vendorReference
    notes
    lineCount
    openLineCount
    nextLineNo
    receivingReceiptId
  }
}
```

Variables:

```json
{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "reason": "Correcting a miscount."
}
```

Send it with the envelope naming the version: `"extensions": {"at": {"version": {"name":"genesis","number":0}}}`.

**Example response**

```json
{
  "data": {
    "issuePurchaseOrder": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "PO-EXMP-0000-000F",
      "type": "PurchaseOrder",
      "caption": "Blue jeans",
      "status": "draft",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "orgVendorId": "01900000-0000-7000-8000-f885fa720000",
      "currency": "USD",
      "paymentTerms": "<payment terms>",
      "incotermCode": "BJ-001",
      "vendorReference": "<vendor reference>",
      "notes": "Restock before the weekend.",
      "lineCount": 1,
      "openLineCount": 1,
      "nextLineNo": 1,
      "receivingReceiptId": "01900000-0000-7000-8000-e3994aee0000"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```

### createReceipt

[createReceipt](/reference/inventory-operations/createReceipt/) — mutation · Create a new goods receipt — stock arriving from a purchase order at your organization.

**Example request**

```graphql
mutation ExampleCreateReceipt($input: CreateReceiptInput!) {
  createReceipt(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    logicalFacilityId
    organizationId
    lineCount
    nextLineNo
  }
}
```

Variables:

```json
{
  "input": {
    "caption": "Blue jeans",
    "purchaseOrderId": "01900000-0000-7000-8000-54a5b8570000",
    "logicalFacilityId": "01900000-0000-7000-8000-8026f71c0000",
    "lines": [
      {
        "poLineNo": 1,
        "quantityReceived": "<quantity received>",
        "disposition": "accept"
      }
    ]
  }
}
```

Send it with the envelope naming the version: `"extensions": {"at": {"version": {"name":"genesis","number":0}}}`.

**Example response**

```json
{
  "data": {
    "createReceipt": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "RC-EXMP-0000-000F",
      "type": "Receipt",
      "caption": "Blue jeans",
      "status": "draft",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "logicalFacilityId": "01900000-0000-7000-8000-8026f71c0000",
      "organizationId": "01900000-0000-7000-8000-44b781470000",
      "lineCount": 1,
      "nextLineNo": 1
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```

### postReceipt

[postReceipt](/reference/inventory-operations/postReceipt/) — mutation · Post a goods receipt — the received quantities book into stock.

**Example request**

```graphql
mutation ExamplePostReceipt($id: ID!, $revision: ID!, $reason: String) {
  postReceipt(id: $id, revision: $revision, reason: $reason) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    logicalFacilityId
    organizationId
    lineCount
    nextLineNo
  }
}
```

Variables:

```json
{
  "id": "01900000-0000-7000-8000-37386ae00000",
  "revision": "01900000-0000-7000-8000-b7960e180000",
  "reason": "Correcting a miscount."
}
```

Send it with the envelope naming the version: `"extensions": {"at": {"version": {"name":"genesis","number":0}}}`.

**Example response**

```json
{
  "data": {
    "postReceipt": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "RC-EXMP-0000-000F",
      "type": "Receipt",
      "caption": "Blue jeans",
      "status": "draft",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "logicalFacilityId": "01900000-0000-7000-8000-8026f71c0000",
      "organizationId": "01900000-0000-7000-8000-44b781470000",
      "lineCount": 1,
      "nextLineNo": 1
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```
