Ramp: Edit a procurement request
Ramp unifiedRequest.patchUnifiedRequestPatchResource: arguments, response, policy and SDK examples.
← Unified request operations · Get started
Operation ramp.patch_unified_request_patch_resource
Provider route: PATCH /developer/v1/unified-requests/{unified_request_id}. 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["unifiedRequest"]["patchUnifiedRequestPatchResource"]>[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.unifiedRequest.patchUnifiedRequestPatchResource(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.unified_request.patch_unified_request_patch_resource(arguments) result = await call.wait() return result.body_json()| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Additional keys: not allowed |
path | object | Required within parent | Additional keys: not allowed |
path.unified_request_id | string | Required within parent | Format: uuid |
headers | object | Optional | Additional keys: not allowed |
headers.X-Idempotency-Key | string | Optional | Maximum length: 255 Minimum length: 1 |
body | Model | Required within parent | Expand Edit a procurement request — request body — body |
Referenced models: Edit a procurement request — 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 Get a unified request — response body |
Referenced models: Get a unified request — response body
Schemas
Section titled “Schemas”397 more schemas are linked from the tables above, on the schema pages.
Edit a procurement request — request body — body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | Sparse scalar edits and complete collection replacements for draft or submitted requests. Additional keys: not allowed |
accounting_field_selections | array | Optional | Complete replacement of request-level accounting selections: omit to preserve, unlisted enabled fields are cleared, [] clears all. |
accounting_field_selections[] | Model | Each item | Expand Edit a procurement request — request body — body accounting field selections item |
currency | Model | Optional | Expand Edit a procurement request — request body — body currency ISO 4217 currency code for the request. Omit to keep the saved value. |
end_date | JSON | Optional | |
end_date (anyOf 1) | string | Alternative | Spend period end, YYYY-MM-DD. Null clears it. Format: date |
end_date (anyOf 2) | null | Alternative | |
entity_id | string | Optional | ID of the business entity for the request. Omit to keep the saved value. Format: uuid |
field_answers | array | Optional | Complete replacement of API-editable answers. Omit to preserve answers; omitted supported field IDs are cleared, and [] clears all supported answers. Unexposed answers, including file uploads, are preserved. |
field_answers[] | JSON | Each item | discriminator: {"mapping": {"address": "#/components/schemas/ApiAddressFieldAnswerRequestBody", "boolean": "#/components/schemas/ApiBooleanFieldAnswerRequestBody", "contact": "#/components/schemas/ApiContactFieldAnswerRequestBody", "date": "#/components/schemas/ApiDateFieldAnswerRequestBody", "department": "#/components/schemas/ApiDepartmentFieldAnswerRequestBody", "email": "#/components/schemas/ApiEmailFieldAnswerRequestBody", "link": "#/components/schemas/ApiLinkFieldAnswerRequestBody", "merchant": "#/components/schemas/ApiMerchantFieldAnswerRequestBody", "merchant_category": "#/components/schemas/ApiMerchantCategoryFieldAnswerRequestBody", "monetary_amount": "#/components/schemas/ApiMonetaryAmountFieldAnswerRequestBody", "multi_select": "#/components/schemas/ApiMultiSelectFieldAnswerRequestBody", "number": "#/components/schemas/ApiNumberFieldAnswerRequestBody", "paragraph": "#/components/schemas/ApiParagraphFieldAnswerRequestBody", "single_select": "#/components/schemas/ApiSingleSelectFieldAnswerRequestBody", "text": "#/components/schemas/ApiTextFieldAnswerRequestBody", "user": "#/components/schemas/ApiUserFieldAnswerRequestBody", "vendor": "#/components/schemas/ApiVendorFieldAnswerRequestBody"}, "propertyName": "answer_type"} |
field_answers[] (oneOf 1) | Model | Alternative | Expand Edit a procurement request — request body — body field answers item answer type address |
field_answers[] (oneOf 2) | Model | Alternative | Expand Edit a procurement request — request body — body field answers item answer type boolean |
field_answers[] (oneOf 3) | Model | Alternative | Expand Edit a procurement request — request body — body field answers item answer type contact |
field_answers[] (oneOf 4) | Model | Alternative | Expand Edit a procurement request — request body — body field answers item answer type date |
field_answers[] (oneOf 5) | Model | Alternative | Expand Edit a procurement request — request body — body field answers item answer type department |
field_answers[] (oneOf 6) | Model | Alternative | Expand Edit a procurement request — request body — body field answers item answer type email |
field_answers[] (oneOf 7) | Model | Alternative | Expand Edit a procurement request — request body — body field answers item answer type link |
field_answers[] (oneOf 8) | Model | Alternative | Expand Edit a procurement request — request body — body field answers item answer type merchant category |
field_answers[] (oneOf 9) | Model | Alternative | Expand Edit a procurement request — request body — body field answers item answer type merchant |
field_answers[] (oneOf 10) | Model | Alternative | Expand Edit a procurement request — request body — body field answers item answer type monetary amount |
field_answers[] (oneOf 11) | Model | Alternative | Expand Edit a procurement request — request body — body field answers item answer type multi select |
field_answers[] (oneOf 12) | Model | Alternative | Expand Edit a procurement request — request body — body field answers item answer type number |
field_answers[] (oneOf 13) | Model | Alternative | Expand Edit a procurement request — request body — body field answers item answer type paragraph |
field_answers[] (oneOf 14) | Model | Alternative | Expand Edit a procurement request — request body — body field answers item answer type single select |
field_answers[] (oneOf 15) | Model | Alternative | Expand Edit a procurement request — request body — body field answers item answer type text |
field_answers[] (oneOf 16) | Model | Alternative | Expand Edit a procurement request — request body — body field answers item answer type user |
field_answers[] (oneOf 17) | Model | Alternative | Expand Edit a procurement request — request body — body field answers item answer type vendor |
line_items | array | Optional | Complete replacement set. Omit to preserve all lines; omitted existing IDs are deleted, and [] removes all source lines. Every item requires unit_price and unit_quantity. Omitted or null description clears it. Retained lines preserve unexposed metadata and omitted coding. |
line_items[] | Model | Each item | Expand Edit a procurement request — request body — body line items item |
name | string | Optional | Name of the request. Omit to keep the saved value. |
start_date | JSON | Optional | |
start_date (anyOf 1) | string | Alternative | Spend period start, YYYY-MM-DD. Null clears it. Format: date |
start_date (anyOf 2) | null | Alternative |
Referenced models: Edit a procurement request — request body — body accounting field selections item, Edit a procurement request — request body — body field answers item answer type address, Edit a procurement request — request body — body field answers item answer type boolean, Edit a procurement request — request body — body field answers item answer type contact, Edit a procurement request — request body — body field answers item answer type date, Edit a procurement request — request body — body field answers item answer type department, Edit a procurement request — request body — body field answers item answer type email, Edit a procurement request — request body — body field answers item answer type link, Edit a procurement request — request body — body field answers item answer type merchant category, Edit a procurement request — request body — body field answers item answer type merchant, Edit a procurement request — request body — body field answers item answer type monetary amount, Edit a procurement request — request body — body field answers item answer type multi select, Edit a procurement request — request body — body field answers item answer type number, Edit a procurement request — request body — body field answers item answer type paragraph, Edit a procurement request — request body — body line items item, Edit a procurement request — request body — body field answers item answer type single select, Edit a procurement request — request body — body field answers item answer type text, Edit a procurement request — request body — body field answers item answer type user, Edit a procurement request — request body — body field answers item answer type vendor, Edit a procurement request — request body — body currency
Get a unified request — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | JSON | Root | discriminator: {"mapping": {"SPEND_REQUEST": "#/components/schemas/UnifiedSpendRequestDetail"}, "propertyName": "unified_request_type"} |
$ (anyOf 1) | Model | Alternative | Expand Get a unified request — response body — value |
Referenced models: Get a unified request — response body — value
Edit a procurement request — request body — body accounting field selections item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | One accounting field selection, identified by Ramp UUIDs. Additional keys: not allowed |
accounting_field_id | string | Required within parent | ID of the accounting field: `id` in the spend program's `line_item_accounting_fields`, or `ramp_id` on GET /accounting/fields. Format: uuid |
accounting_field_option_id | string | Required within parent | ID of an option of that field: `ramp_id` on GET /accounting/field-options (GET /accounting/accounts for GL accounts). Format: uuid |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: ramp.patch_unified_request_patch_resource. Catalog operation: patch_unified_request_patch_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: ["unified_requests:write"]