Skip to content

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.

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 os
from alter_sdk import App
from 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()
FieldTypePresenceDescription and constraints
$objectRootAdditional keys: not allowed
bodyModelRequired within parentExpand Create a purchase order — request body — body

Referenced models: Create a purchase order — request body — body

Response media type: application/json. The table describes the pinned successful response. Referenced models link to their complete fields.

FieldTypePresenceDescription and constraints
$ModelRootExpand Create a purchase order — response body

Referenced models: Create a purchase order — response body

5 more schemas are linked from the tables above, on the schema pages.

Create a purchase order — request body — body
FieldTypePresenceDescription and constraints
$objectRoot
accounting_field_selectionsarrayOptionalList of accounting field options selected to code the purchase order. Generally, only a single vendor accounting field is supported.
accounting_field_selections[]ModelEach itemExpand Create a bill — request body — body accounting field selections item
currencystringRequired within parentCurrency 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_idstringRequired within parentUnique identifier of associated business entity.
Format: uuid
external_idJSONOptional
external_id (anyOf 1)stringAlternativeAn 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)nullAlternative
line_itemsarrayRequired within parentList of purchase order line items.
line_items[]ModelEach itemExpand Create a purchase order — request body — body line items item
memoJSONOptional
memo (anyOf 1)stringAlternativeMemo for the purchase order.
Default: null
memo (anyOf 2)nullAlternative
nameJSONOptional
name (anyOf 1)stringAlternativeName of the purchase order. Must contain a non-whitespace character.
Default: null
Pattern: \s*\S
name (anyOf 2)nullAlternative
net_payment_termsJSONOptional
net_payment_terms (anyOf 1)integerAlternativeThe required time an invoice needs to be paid after receipt in days.
Default: null
net_payment_terms (anyOf 2)nullAlternative
owner_idJSONOptional
owner_id (anyOf 1)stringAlternativeUnique identifier for the owner of the purchase order. Defaults to the API caller when not provided.
Default: null
Format: uuid
owner_id (anyOf 2)nullAlternative
promise_dateJSONOptional
promise_date (anyOf 1)stringAlternativeThe date the vendor will deliver the goods or services.
Default: null
Format: date
promise_date (anyOf 2)nullAlternative
purchase_order_numberJSONOptional
purchase_order_number (anyOf 1)stringAlternativeUnique 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)nullAlternative
spend_end_dateJSONOptional
spend_end_date (anyOf 1)stringAlternativeThe date when spending for this purchase order ends.
Default: null
Format: date
spend_end_date (anyOf 2)nullAlternative
spend_start_dateJSONOptional
spend_start_date (anyOf 1)stringAlternativeThe date when spending for this purchase order begins.
Default: null
Format: date
spend_start_date (anyOf 2)nullAlternative
three_way_match_enabledbooleanRequired within parentWhether three-way match is enabled for the purchase order. I.e. whether an item receipt will be attached to indicate goods were received.
vendor_idJSONOptional
vendor_id (anyOf 1)stringAlternativeUnique identifier for the vendor.
Default: null
Format: uuid
vendor_id (anyOf 2)nullAlternative
withholding_default_rateJSONOptional
withholding_default_rate (anyOf 1)JSONAlternativeDefault 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)stringAlternativeFormat: decimal
withholding_default_rate (anyOf 1) (oneOf 2)numberAlternative
withholding_default_rate (anyOf 2)nullAlternative

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
FieldTypePresenceDescription and constraints
$objectRoot
field_external_idstringRequired within parentRemote ID of accounting field. This is the external ID, likely from ERP system.
field_option_external_idJSONOptional
field_option_external_id (anyOf 1)stringAlternativeRemote 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)nullAlternative
free_form_textJSONOptional
free_form_text (anyOf 1)stringAlternativeFree 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)nullAlternative
Create a purchase order — request body — body line items item
FieldTypePresenceDescription and constraints
$objectRoot
accounting_field_selectionsarrayOptionalList of accounting field options selected to code the line item.
accounting_field_selections[]ModelEach itemExpand Create a bill — request body — body accounting field selections item
descriptionJSONOptional
description (anyOf 1)stringAlternativeDescription of the line item.
Default: null
description (anyOf 2)nullAlternative
end_dateJSONOptional
end_date (anyOf 1)stringAlternativeThe date when spending for this line item ends.
Default: null
Format: date
end_date (anyOf 2)nullAlternative
external_idJSONOptional
external_id (anyOf 1)stringAlternativeAn 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)nullAlternative
start_dateJSONOptional
start_date (anyOf 1)stringAlternativeThe date when spending for this line item begins.
Default: null
Format: date
start_date (anyOf 2)nullAlternative
unit_priceJSONRequired within parentUnit price of the line item.
unit_price (oneOf 1)stringAlternativeFormat: decimal
unit_price (oneOf 2)numberAlternative
unit_quantityJSONRequired within parentQuantity of the line item. Supports fractional values as a JSON number or decimal string.
unit_quantity (oneOf 1)stringAlternativeFormat: decimal
unit_quantity (oneOf 2)numberAlternative
withholding_rateJSONOptional
withholding_rate (anyOf 1)JSONAlternativeRetainage 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)stringAlternativeFormat: decimal
withholding_rate (anyOf 1) (oneOf 2)numberAlternative
withholding_rate (anyOf 2)nullAlternative

Referenced models: Create a bill — request body — body accounting field selections item

Hold Bill — response body — accounting field selections item
FieldTypePresenceDescription and constraints
$objectRoot
category_infoModelRequired within parentExpand Hold Bill — response body — accounting field selections item category info
information about the accounting category (or accounting field).
display_nameJSONRequired within parent
display_name (anyOf 1)stringAlternativeCustomer-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)nullAlternative
external_codeJSONOptional
external_code (anyOf 1)stringAlternativeexternal code of accounting field option; Code field displayed on the ERP.
external_code (anyOf 2)nullAlternative
external_idstringRequired within parentexternal id of accounting field option; It should uniquely identify an accounting field option on the client end.
idstringRequired within parentID that uniquely identifies an accounting field option within Ramp
namestringRequired within parentname of accounting field option
provider_nameJSONRequired within parent
provider_name (anyOf 1)stringAlternativeName of the accounting provider
Read only: true
provider_name (anyOf 2)nullAlternative

Referenced models: Hold Bill — response body — accounting field selections item category info

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"]

Official provider source

Report an issue with this page

Necessary

Required for sign-in, security, authorization, and remembering your choices.

Always active

Analytics

Helps us understand which product and documentation features are useful.

Performance diagnostics

Uses performance tracing and privacy-masked session replay to diagnose problems.

You can change these choices at any time from Cookie settings.