> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.gappify.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.gappify.com/_mcp/server.

# Create a new or update existing Purchase Orders entries.

POST https://api.gappify.com/v1/purchase-orders
Content-Type: application/json

Create a new or update existing Purchase Orders entries with the provided data.

## Required Fields Summary

| Field                     | Type   | Description                                                    |
| ------------------------- | ------ | -------------------------------------------------------------- |
| `source_system_id`        | string | Unique identifier of the purchase order line in the ERP system |
| `vendor_id`               | string | Id of the Vendor/Supplier                                      |
| `po_line_amount`          | double | Total amount in transaction currency of the PO line            |
| `po_line_status`          | string | Status of the PO line                                          |
| `transaction_currency_id` | string | Currency id in which the transaction was posted                |

The `type` field selects which identifier trio is required on each row:

* `type` = `po` (or blank/null) — requires `po_id`, `po_number`, `po_line_id`.
* `type` = `pr` — requires `pr_id`, `pr_number`, `pr_line_id` instead.

The opposing trio is not policed on ingest, so a row may still carry values from both; consumers choose which to display based on `type`.

If using the **Insights Module**, the following fields are also required:

* `po_owner`
* `po_date`

Reference: https://developers.gappify.com/api-reference/inbound-to-gappify/4/post

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Servers

- `https://api.gappify.com/v1` (Production, default)
- `https://api.uat.gappifyinc.com/v1` (UAT)

## Request

### Body (application/json)

This endpoint expects a list of PurchaseOrdersPostPayload.

- `list of PurchaseOrdersPostPayload`

## Response

### 202

- `request_id` (UUID, required) — Unique identifier for the request
- `status` ("IN_PROGRESS", required) — Status of the request

## Errors

### 401 Unauthorized Error

- `message` (string, required) — The error message
- `success` (boolean, required)

### 422 Unprocessable Entity Error

- `message` (string, required) — The error message
- `errors` (string, required) — The error details

### 404 Not Found Error

- `list of string`

### 500 Internal Server Error

- `list of string`

## Types

### PurchaseOrdersPostPayload

- `source_system_id` (string, required) — Unique identifier of the purchase order line in the erp system. This value will be used to match source data and perform upserts.
- `vendor_id` (string, required) — Id of the Vendor/Supplier. This value should match the source_vendors->g_source_system_id which will be used to send back as part of JE to ERP.
- `po_line_amount` (double, required) — Total amount in transaction currency of the PO line.
- `po_line_status` (string, required) — Status of the PO line. Status will be leveraged to filter lines that are not active anymore.
- `transaction_currency_id` (string, required) — Currency id in which the transaction was posted in the gl. Should match the g_source_system_id in the currency list of source_coas.
- `po_id` (string, optional) — System Id of the purchase order record. Required when `type` is `po` or blank/null; omit for PR rows.
- `po_number` (string, optional) — PO number value. Required when `type` is `po` or blank/null; omit for PR rows.
- `po_line_id` (string, optional) — System Id of the purchase order line. Required when `type` is `po` or blank/null; omit for PR rows.
- `po_header_description` (string, optional) — Description of the purchase order.
- `po_line_description` (string, optional) — Description of the PO line.
- `po_header_amount` (double, optional) — Total amount at the header level of the PO in transaction currency.
- `po_owner` (string, optional) — Name of the PO owner.
- `service_end_date` (date, optional) — End date of the PO line.
- `service_start_date` (date, optional) — Start date of the PO line.
- `invoiced_amount` (double, optional) — Amount invoiced in transaction currency of the PO line.
- `po_balance` (double, optional) — Balance remaining in transaction currency of the PO line.
- `email` (string, optional) — Email of the PO owner.
- `subsidiary_id` (string, optional) — Subsidiary id linked to the po line. This value should match the g_source_system_id in source_coas.
- `subsidiary_currency_id` (string, optional) — Subsidiary currency id of the posted transaction line in the gl. Should match the name in the currency list of source_coas.
- `glaccount_debit_id` (string, optional) — Expense glaccount id linked to the po line. This value should match the g_source_system_id in source_coas.
- `glaccount_credit_id` (string, optional) — Liability glaccount id linked to the po line. This value should match the g_source_system_id in source_coas.
- `department_debit_id` (string, optional) — Expense department/cost center id linked to the po line. This value should match the g_source_system_id in source_coas
- `department_credit_id` (string, optional) — Liability department/cost center id linked to the po line. This value should match the g_source_system_id in source_coas.
- `location_debit_id` (string, optional) — Expense location id linked to the po line. This value should match the g_source_system_id in source_coas.
- `location_credit_id` (string, optional) — Liability location id linked to the po line. This value should match the g_source_system_id in source_coas.
- `class_debit_id` (string, optional) — Expense class id linked to the po line. This value should match the g_source_system_id in source_coas.
- `class_credit_id` (string, optional) — Liability class id linked to the po line. This value should match the g_source_system_id in source_coas.
- `product_debit_id` (string, optional) — Expense product id linked to the po line. This value should match the g_source_system_id in source_coas.
- `product_credit_id` (string, optional) — Liability product id linked to the po line. This value should match the g_source_system_id in source_coas.
- `project_debit_id` (string, optional) — Expense project id linked to the po line. This value should match the g_source_system_id in source_coas.
- `project_credit_id` (string, optional) — Liability project id linked to the po line. This value should match the g_source_system_id in source_coas.
- `region_debit_id` (string, optional) — Expense region id linked to the po line. This value should match the g_source_system_id in source_coas.
- `region_credit_id` (string, optional) — Liability region id linked to the po line. This value should match the g_source_system_id in source_coas.
- `company_debit_id` (string, optional) — Expense company id linked to the po line. This value should match the g_source_system_id in source_coas.
- `company_credit_id` (string, optional) — Liability company id linked to the po line. This value should match the g_source_system_id in source_coas.
- `intercompany_debit_id` (string, optional) — Expense intercompany id linked to the po line. This value should match the g_source_system_id in source_coas.
- `intercompany_credit_id` (string, optional) — Liability intercompany id linked to the po line. This value should match the g_source_system_id in source_coas.
- `channel_debit_id` (string, optional) — Expense channel id linked to the po line. This value should match the g_source_system_id in source_coas.
- `channel_credit_id` (string, optional) — Liability channel id linked to the po line. This value should match the g_source_system_id in source_coas.
- `po_line_amount_cancelled` (double, optional) — Any po line amount that has been canceled.
- `cc_email` (string, optional) — CC emails to be used as part of outreach. Emails should be ";" separated.
- `po_date` (date, optional) — PO creation date
- `po_line_amount_usd` (double, optional)
- `po_balance_usd` (double, optional)
- `prepaid_account` (string, optional) — GL account name used for prepaid expenses when posting prepaid journal entries. Links to source_coas name.
- `prepaid_account_id` (string, optional) — GL account ID used for prepaid expenses when posting prepaid journal entries. Links to source_coas source_system_id.
- `custom_text_1` (string, optional) — User-defined custom text field
- `custom_text_2` (string, optional) — User-defined custom text field
- `custom_text_3` (string, optional) — User-defined custom text field
- `custom_text_4` (string, optional) — User-defined custom text field
- `custom_text_5` (string, optional) — User-defined custom text field
- `custom_date_1` (date, optional) — User-defined custom date field
- `custom_date_2` (date, optional) — User-defined custom date field
- `custom_date_3` (date, optional) — User-defined custom date field
- `custom_date_4` (date, optional) — User-defined custom date field
- `custom_date_5` (date, optional) — User-defined custom date field
- `custom_numeric_1` (float, optional) — User-defined custom numeric field
- `custom_numeric_2` (float, optional) — User-defined custom numeric field
- `custom_numeric_3` (float, optional) — User-defined custom numeric field
- `custom_numeric_4` (float, optional) — User-defined custom numeric field
- `custom_numeric_5` (float, optional) — User-defined custom numeric field
- `type` (string, optional) — Row discriminator. Set to `pr` to ingest a Purchase Request; `po` or blank/null is treated as a Purchase Order. Values are case-normalized to lowercase on write.
- `pr_id` (string, optional) — System Id of the purchase request record. Required when `type` is `pr`; omit for PO rows.
- `pr_number` (string, optional) — PR number value. Required when `type` is `pr`; omit for PO rows.
- `pr_line_id` (string, optional) — System Id of the purchase request line. Required when `type` is `pr`; omit for PO rows.

## Examples

**Request**

```json
[
  {
    "source_system_id": "source_system_id",
    "vendor_id": "vendor_id",
    "po_line_amount": 1.1,
    "po_line_status": "po_line_status",
    "transaction_currency_id": "transaction_currency_id"
  },
  {
    "source_system_id": "source_system_id",
    "vendor_id": "vendor_id",
    "po_line_amount": 1.1,
    "po_line_status": "po_line_status",
    "transaction_currency_id": "transaction_currency_id"
  }
]
```

**Response**

```json
{
  "request_id": "d5e9c84f-c2b2-4bf4-b4b0-7ffd7a9ffc32",
  "status": "IN_PROGRESS"
}
```

**SDK Code**

```python
import requests

url = "https://api.gappify.com/v1/purchase-orders"

payload = [
    {
        "source_system_id": "source_system_id",
        "vendor_id": "vendor_id",
        "po_line_amount": 1.1,
        "po_line_status": "po_line_status",
        "transaction_currency_id": "transaction_currency_id"
    },
    {
        "source_system_id": "source_system_id",
        "vendor_id": "vendor_id",
        "po_line_amount": 1.1,
        "po_line_status": "po_line_status",
        "transaction_currency_id": "transaction_currency_id"
    }
]
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.gappify.com/v1/purchase-orders';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '[{"source_system_id":"source_system_id","vendor_id":"vendor_id","po_line_amount":1.1,"po_line_status":"po_line_status","transaction_currency_id":"transaction_currency_id"},{"source_system_id":"source_system_id","vendor_id":"vendor_id","po_line_amount":1.1,"po_line_status":"po_line_status","transaction_currency_id":"transaction_currency_id"}]'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.gappify.com/v1/purchase-orders"

	payload := strings.NewReader("[\n  {\n    \"source_system_id\": \"source_system_id\",\n    \"vendor_id\": \"vendor_id\",\n    \"po_line_amount\": 1.1,\n    \"po_line_status\": \"po_line_status\",\n    \"transaction_currency_id\": \"transaction_currency_id\"\n  },\n  {\n    \"source_system_id\": \"source_system_id\",\n    \"vendor_id\": \"vendor_id\",\n    \"po_line_amount\": 1.1,\n    \"po_line_status\": \"po_line_status\",\n    \"transaction_currency_id\": \"transaction_currency_id\"\n  }\n]")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.gappify.com/v1/purchase-orders")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "[\n  {\n    \"source_system_id\": \"source_system_id\",\n    \"vendor_id\": \"vendor_id\",\n    \"po_line_amount\": 1.1,\n    \"po_line_status\": \"po_line_status\",\n    \"transaction_currency_id\": \"transaction_currency_id\"\n  },\n  {\n    \"source_system_id\": \"source_system_id\",\n    \"vendor_id\": \"vendor_id\",\n    \"po_line_amount\": 1.1,\n    \"po_line_status\": \"po_line_status\",\n    \"transaction_currency_id\": \"transaction_currency_id\"\n  }\n]"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.gappify.com/v1/purchase-orders")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("[\n  {\n    \"source_system_id\": \"source_system_id\",\n    \"vendor_id\": \"vendor_id\",\n    \"po_line_amount\": 1.1,\n    \"po_line_status\": \"po_line_status\",\n    \"transaction_currency_id\": \"transaction_currency_id\"\n  },\n  {\n    \"source_system_id\": \"source_system_id\",\n    \"vendor_id\": \"vendor_id\",\n    \"po_line_amount\": 1.1,\n    \"po_line_status\": \"po_line_status\",\n    \"transaction_currency_id\": \"transaction_currency_id\"\n  }\n]")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.gappify.com/v1/purchase-orders', [
  'body' => '[
  {
    "source_system_id": "source_system_id",
    "vendor_id": "vendor_id",
    "po_line_amount": 1.1,
    "po_line_status": "po_line_status",
    "transaction_currency_id": "transaction_currency_id"
  },
  {
    "source_system_id": "source_system_id",
    "vendor_id": "vendor_id",
    "po_line_amount": 1.1,
    "po_line_status": "po_line_status",
    "transaction_currency_id": "transaction_currency_id"
  }
]',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.gappify.com/v1/purchase-orders");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "[\n  {\n    \"source_system_id\": \"source_system_id\",\n    \"vendor_id\": \"vendor_id\",\n    \"po_line_amount\": 1.1,\n    \"po_line_status\": \"po_line_status\",\n    \"transaction_currency_id\": \"transaction_currency_id\"\n  },\n  {\n    \"source_system_id\": \"source_system_id\",\n    \"vendor_id\": \"vendor_id\",\n    \"po_line_amount\": 1.1,\n    \"po_line_status\": \"po_line_status\",\n    \"transaction_currency_id\": \"transaction_currency_id\"\n  }\n]", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  [
    "source_system_id": "source_system_id",
    "vendor_id": "vendor_id",
    "po_line_amount": 1.1,
    "po_line_status": "po_line_status",
    "transaction_currency_id": "transaction_currency_id"
  ],
  [
    "source_system_id": "source_system_id",
    "vendor_id": "vendor_id",
    "po_line_amount": 1.1,
    "po_line_status": "po_line_status",
    "transaction_currency_id": "transaction_currency_id"
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.gappify.com/v1/purchase-orders")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```