Ramp: Create a purchase order
Ramp purchaseOrder.postPurchaseOrdersResource: arguments, response, policy and SDK examples.
← Purchase order operations · Get started
Operation ramp.post_purchase_orders_resource
Provider route: POST /developer/v1/purchase-orders. Alter supplies the connection’s credentials and routing.
Call through Alter
Section titled “Call through Alter”Install @alter-ai/sdk @alter-ai/ramp with npm, or alter-sdk-ramp with pip. Supply your connected customer’s grant ID and the arguments described below.
import { App } from "@alter-ai/sdk";import { RampIntegration } from "@alter-ai/ramp";
async function execute(input: Parameters<RampIntegration["purchaseOrder"]["postPurchaseOrdersResource"]>[0]) { const app = new App({ apiKey: process.env.ALTER_API_KEY! }); try { const provider = new RampIntegration(app, { grantId: process.env.PROVIDER_GRANT_ID! }); const call = await provider.purchaseOrder.postPurchaseOrdersResource(input); const result = await call.wait(); return result.bodyJson(); } finally { await app.close(); }}import osfrom alter_sdk import Appfrom alter_sdk_ramp import RampIntegration
async def execute(arguments): async with App(api_key=os.environ["ALTER_API_KEY"]) as app: provider = RampIntegration(app, {"grant_id": os.environ["PROVIDER_GRANT_ID"]}) call = await provider.purchase_order.post_purchase_orders_resource(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
body | Model | Required within parent | Expand Create a purchase order — request body — body |
Referenced models: Create a purchase order — request body — body
Response
Section titled “Response”Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | Model | Root | Expand Create a purchase order — response body |
Referenced models: Create a purchase order — response body
Schemas
Section titled “Schemas”5 more schemas are linked from the tables above, on the schema pages.
Create a purchase order — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
accounting_field_selections | array | Optional | List of accounting field options selected to code the purchase order. Generally, only a single vendor accounting field is supported. |
accounting_field_selections[] | Model | Each item | Expand Create a bill — request body — body accounting field selections item |
currency | string | Required within parent | Currency of the purchase order. One of: AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BOV, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHE, CHF, CHW, CLF, CLP, CNH, CNY, COP, COU, CRC, CUC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, EURC, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MXV, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, OPEN_USD, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLE, SLL, SOS, SRD, SSP, STN, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, USDB, USDC, USDG, USDT, USN, UYI, UYU, UYW, UZS, VED, VES, VND, VUV, WST, XAD, XAF, XAG, XAU, XBA, XBB, XBC, XBD, XCD, XCG, XDR, XOF, XPD, XPF, XPT, XSU, XTS, XUA, XXX, YER, ZAR, ZMW, ZWG, ZWL |
entity_id | string | Required within parent | Unique identifier of associated business entity. Format: uuid |
external_id | JSON | Optional | |
external_id (anyOf 1) | string | Alternative | An ID that uniquely identifies the purchase order on the client's side. Must be unique per business and cannot be updated after creation. Default: null |
external_id (anyOf 2) | null | Alternative | |
line_items | array | Required within parent | List of purchase order line items. |
line_items[] | Model | Each item | Expand Create a purchase order — request body — body line items item |
memo | JSON | Optional | |
memo (anyOf 1) | string | Alternative | Memo for the purchase order. Default: null |
memo (anyOf 2) | null | Alternative | |
name | JSON | Optional | |
name (anyOf 1) | string | Alternative | Name of the purchase order. Must contain a non-whitespace character. Default: null Pattern: \s*\S |
name (anyOf 2) | null | Alternative | |
net_payment_terms | JSON | Optional | |
net_payment_terms (anyOf 1) | integer | Alternative | The required time an invoice needs to be paid after receipt in days. Default: null |
net_payment_terms (anyOf 2) | null | Alternative | |
owner_id | JSON | Optional | |
owner_id (anyOf 1) | string | Alternative | Unique identifier for the owner of the purchase order. Defaults to the API caller when not provided. Default: null Format: uuid |
owner_id (anyOf 2) | null | Alternative | |
promise_date | JSON | Optional | |
promise_date (anyOf 1) | string | Alternative | The date the vendor will deliver the goods or services. Default: null Format: date |
promise_date (anyOf 2) | null | Alternative | |
purchase_order_number | JSON | Optional | |
purchase_order_number (anyOf 1) | string | Alternative | Unique purchase order number with format <prefix>-<number>. Prefixes must only contain numbers, uppercase letters, and dashes. Invalid characters will be filtered out automatically. If not provided, one will be auto-generated using a prefix specified in procurement settings, if it exists. Default: null |
purchase_order_number (anyOf 2) | null | Alternative | |
spend_end_date | JSON | Optional | |
spend_end_date (anyOf 1) | string | Alternative | The date when spending for this purchase order ends. Default: null Format: date |
spend_end_date (anyOf 2) | null | Alternative | |
spend_start_date | JSON | Optional | |
spend_start_date (anyOf 1) | string | Alternative | The date when spending for this purchase order begins. Default: null Format: date |
spend_start_date (anyOf 2) | null | Alternative | |
three_way_match_enabled | boolean | Required within parent | Whether three-way match is enabled for the purchase order. I.e. whether an item receipt will be attached to indicate goods were received. |
vendor_id | JSON | Optional | |
vendor_id (anyOf 1) | string | Alternative | Unique identifier for the vendor. Default: null Format: uuid |
vendor_id (anyOf 2) | null | Alternative | |
withholding_default_rate | JSON | Optional | |
withholding_default_rate (anyOf 1) | JSON | Alternative | Default retainage withholding rate for the purchase order, expressed as a fractional decimal. For example, 0.10 means 10%. Default: null Minimum: 0 Less than: 1 |
withholding_default_rate (anyOf 1) (oneOf 1) | string | Alternative | Format: decimal |
withholding_default_rate (anyOf 1) (oneOf 2) | number | Alternative | |
withholding_default_rate (anyOf 2) | null | Alternative |
Referenced models: Create a bill — request body — body accounting field selections item, Create a purchase order — request body — body line items item
Create a bill — request body — body accounting field selections item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
field_external_id | string | Required within parent | Remote ID of accounting field. This is the external ID, likely from ERP system. |
field_option_external_id | JSON | Optional | |
field_option_external_id (anyOf 1) | string | Alternative | Remote ID of accounting field option. This is the external ID, likely from ERP system. Required if free_form_text is not provided. Default: null |
field_option_external_id (anyOf 2) | null | Alternative | |
free_form_text | JSON | Optional | |
free_form_text (anyOf 1) | string | Alternative | Free form text for the accounting field selection. For DATE-type fields, use ISO format (YYYY-MM-DD). Required if field_option_external_id is not provided. Default: null Minimum length: 1 |
free_form_text (anyOf 2) | null | Alternative |
Create a purchase order — request body — body line items item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
accounting_field_selections | array | Optional | List of accounting field options selected to code the line item. |
accounting_field_selections[] | Model | Each item | Expand Create a bill — request body — body accounting field selections item |
description | JSON | Optional | |
description (anyOf 1) | string | Alternative | Description of the line item. Default: null |
description (anyOf 2) | null | Alternative | |
end_date | JSON | Optional | |
end_date (anyOf 1) | string | Alternative | The date when spending for this line item ends. Default: null Format: date |
end_date (anyOf 2) | null | Alternative | |
external_id | JSON | Optional | |
external_id (anyOf 1) | string | Alternative | An ID that identifies the line item on the client's side. Must be unique within the purchase order and cannot be updated after creation. Default: null |
external_id (anyOf 2) | null | Alternative | |
start_date | JSON | Optional | |
start_date (anyOf 1) | string | Alternative | The date when spending for this line item begins. Default: null Format: date |
start_date (anyOf 2) | null | Alternative | |
unit_price | JSON | Required within parent | Unit price of the line item. |
unit_price (oneOf 1) | string | Alternative | Format: decimal |
unit_price (oneOf 2) | number | Alternative | |
unit_quantity | JSON | Required within parent | Quantity of the line item. Supports fractional values as a JSON number or decimal string. |
unit_quantity (oneOf 1) | string | Alternative | Format: decimal |
unit_quantity (oneOf 2) | number | Alternative | |
withholding_rate | JSON | Optional | |
withholding_rate (anyOf 1) | JSON | Alternative | Retainage withholding rate for the line item, expressed as a fractional decimal. If set, this line-level rate overrides the purchase order withholding_default_rate for this line item. For example, 0.10 means 10%. Default: null Minimum: 0 Less than: 1 |
withholding_rate (anyOf 1) (oneOf 1) | string | Alternative | Format: decimal |
withholding_rate (anyOf 1) (oneOf 2) | number | Alternative | |
withholding_rate (anyOf 2) | null | Alternative |
Referenced models: Create a bill — request body — body accounting field selections item
Hold Bill — response body — accounting field selections item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
category_info | Model | Required within parent | Expand Hold Bill — response body — accounting field selections item category info information about the accounting category (or accounting field). |
display_name | JSON | Required within parent | |
display_name (anyOf 1) | string | Alternative | Customer-set display name for the accounting field option in Ramp. When the customer renames an option inside Ramp, this returns the new label while `name` continues to return the ERP-source name. May be null if no Ramp-side override is set. |
display_name (anyOf 2) | null | Alternative | |
external_code | JSON | Optional | |
external_code (anyOf 1) | string | Alternative | external code of accounting field option; Code field displayed on the ERP. |
external_code (anyOf 2) | null | Alternative | |
external_id | string | Required within parent | external id of accounting field option; It should uniquely identify an accounting field option on the client end. |
id | string | Required within parent | ID that uniquely identifies an accounting field option within Ramp |
name | string | Required within parent | name of accounting field option |
provider_name | JSON | Required within parent | |
provider_name (anyOf 1) | string | Alternative | Name of the accounting provider Read only: true |
provider_name (anyOf 2) | null | Alternative |
Referenced models: Hold Bill — response body — accounting field selections item category info
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: ramp.post_purchase_orders_resource. Catalog operation: post_purchase_orders_resource. Rules can name either ID; function rules distinguish managed calls and conservatively cover raw calls sharing the route. Existing grant permissions and policy rules apply. wait() returns an immediate result or waits for a required approval; it never approves the request itself. Persist the approval ID to resume after a restart.
Provider errors retain their response; JSON decoding raises ProviderAPIError for provider failures. ManagedOperationError identifies contract/input/retention errors. See error handling and provider-specific behavior. Sensitive input may be refused before approval storage. A decoding error never resubmits a write.
Required provider scopes: ["purchase_orders:write"]