Ramp: Fetch a trip
Ramp trips.getTripSingleResource: arguments, response, policy and SDK examples.
← Trips operations · Get started
Operation ramp.get_trip_single_resource
Provider route: GET /developer/v1/trips/{trip_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["trips"]["getTripSingleResource"]>[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.trips.getTripSingleResource(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.trips.get_trip_single_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.trip_id | string | Required within parent | Format: uuid |
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 Fetch a trip — response body |
Referenced models: Fetch a trip — response body
Schemas
Section titled “Schemas”Fetch a trip — response body
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
created_at | string | Required within parent | The date the trip was created Format: date-time |
description | JSON | Required within parent | |
description (anyOf 1) | string | Alternative | The description for the trip |
description (anyOf 2) | null | Alternative | |
end_date | string | Required within parent | The date the trip ends Format: date-time |
id | string | Required within parent | Unique identifier for the trip Format: uuid |
length_in_days | JSON | Required within parent | |
length_in_days (anyOf 1) | integer | Alternative | Number of days for the trip |
length_in_days (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
locations | array | Required within parent | Destinations and location segments for the trip |
locations[] | Model | Each item | Expand Fetch a trip — response body — locations item |
name | string | Required within parent | The name of the trip |
spend_events | array | Required within parent | Spend events for the trip |
spend_events[] | Model | Each item | Expand Fetch a trip — response body — spend events item |
start_date | string | Required within parent | The date the trip starts Format: date-time |
status | string | Required within parent | Current trip status Known values: cancelled, completed, ongoing, upcoming |
total_spend | JSON | Required within parent | |
total_spend (anyOf 1) | number | Alternative | Total spend for the trip. Deprecated: use `total_spend_amount` instead. Read only: true |
total_spend (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
total_spend_amount | JSON | Required within parent | |
total_spend_amount (anyOf 1) | Model | Alternative | Expand Fetch a transaction — response body — entity amount currency, value Total spend for the trip in minor units with an explicit ISO 4217 currency code. May be negative for refund-dominated trips. `null` when the trip has no spend events or its spend events do not share a single recognized currency. Read only: true |
total_spend_amount (anyOf 2) | null | Alternative | |
travel_types | array | Required within parent | Types of travel for this trip (flights, hotels, cars) Read only: true |
travel_types[] | string | Each item | Known values: CAR, FLIGHT, HOTEL |
updated_at | string | Required within parent | The date the trip was last updated Format: date-time |
user_id | string | Required within parent | User/traveler's ID Format: uuid |
Referenced models: Fetch a transaction — response body — entity amount currency, value, Fetch a trip — response body — locations item, Fetch a trip — response body — spend events item
Fetch a transaction — response body — entity amount currency, value
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
currency | string | Required within parent | The currency of the amount in ISO 4217 format (e.g. USD). Known values: 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 |
value | JSON | Required within parent | |
value (anyOf 1) | integer | Alternative | The amount in the smallest denomination of the currency (e.g. cents for USD). May be negative for refunds or credits. |
value (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
Fetch a trip — response body — locations item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
end_date | string | Required within parent | The date the trip segment ends Format: date-time |
location | Model | Required within parent | Expand Fetch a trip — response body — locations item location The location of the trip segment |
start_date | string | Required within parent | The date the trip segment starts Format: date-time |
Referenced models: Fetch a trip — response body — locations item location
Fetch a trip — response body — spend events item
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
id | string | Required within parent | The ID of the spend event Format: uuid Read only: true |
spend_type | string | Required within parent | The type of the spend event Known values: BILL, REIMBURSEMENT, TRANSACTION |
Fetch a trip — response body — locations item location
| Field | Type | Presence | Description and constraints |
|---|---|---|---|
$ | object | Root | |
city | JSON | Required within parent | |
city (anyOf 1) | string | Alternative | |
city (anyOf 2) | null | Alternative | |
country | JSON | Required within parent | |
country (anyOf 1) | string | Alternative | |
country (anyOf 2) | null | Alternative | |
latitude | JSON | Required within parent | |
latitude (anyOf 1) | JSON | Alternative | |
latitude (anyOf 1) (anyOf 1) | number | Alternative | |
latitude (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
latitude (anyOf 2) | null | Alternative | |
longitude | JSON | Required within parent | |
longitude (anyOf 1) | JSON | Alternative | |
longitude (anyOf 1) (anyOf 1) | number | Alternative | |
longitude (anyOf 1) (anyOf 2) | string | Alternative | Pattern: ^-?[0-9]+(?:\.[0-9]+)?(?:[eE][+-]?[0-9]+)?$ |
longitude (anyOf 2) | null | Alternative | |
state | JSON | Required within parent | |
state (anyOf 1) | string | Alternative | |
state (anyOf 2) | null | Alternative |
Policy, approvals and errors
Section titled “Policy, approvals and errors”SDK function policy ID: ramp.get_trip_single_resource. Catalog operation: get_trip_single_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: ["trips:read"]