Skip to main content

ShipStation Mapping Functions

Reference for the ShipStation-specific functions you can use in Dynamic Formula mappings and mapping collection filters.

Overview

The ShipStation integration provides ready-made functions you can call when building mappings. They handle the common lookups a shipment needs, resolving the ShipStation identifiers for a Ship From Location, a store, a carrier, or a carrier service from the names you know, and mapping an iPaaS.com location to its ShipStation location, so you do not have to write those lookups yourself in a formula.

Where you can use these functions

These functions are available anywhere you write a formula for the ShipStation integration:

  • Dynamic Formula mappings: where a destination field's value is produced by a formula rather than mapped directly from a source field.

  • Mapping collection filters: where a formula decides whether a record should be processed.

  • Error filters: a mapping collection's error filter, which sits alongside its collection filter. When the error filter's formula resolves to true, the transfer raises an error that is held in the Error Logs for review and is not retried automatically.

  • Translation collections: where a translation entry uses a formula as its source value.

How to use them

  • Call a function by name and pass the values it needs in parentheses, for example: await GetWarehouseIdByNameAsync("Main Warehouse").

  • Each function's signature shows its name, the parameters it accepts (with their types), and the type of value it returns. Use it as the reference for exactly how to call the function.

  • Function names and formula syntax are case-sensitive, so type each name exactly as shown. Whether the values a function matches are treated as case-sensitive varies by function, and is called out in the relevant parameter's description.

  • Every function that returns a Task is asynchronous and must be called with await, as shown in each How to call it example.

  • Each function runs at sync time, against the data in your connected ShipStation account and your iPaaS.com subscription. Lookups by name are cached for the duration of a transfer, so a name is resolved once per transfer rather than once per shipment.

The functions are grouped below by the area of the integration they support.

Shipments

GetWarehouseIdByNameAsync

What it does: Looks up the ShipStation identifier of a Ship From Location (warehouse) by its name, for the Ship From Location a shipment ships from.

Signature: Task<string> GetWarehouseIdByNameAsync(string name)

How to call it: await GetWarehouseIdByNameAsync(name)

Parameter

Type

Required

Default

Description

name

string

Yes

N/A

The name of the ShipStation Ship From Location to look up, as shown in ShipStation under Account Settings, Shipping, Ship From Locations. Matched without regard to case.

Returns: string. The ShipStation identifier of the matching Ship From Location, or null if no location has that name.

Example: "Death Star" returns "se-145958", the identifier of the Ship From Location named Death Star.

When to use it: Use this for the Shipment_WarehouseId field on the shipment address collection, which every shipment requires. The shipped mapping calls it with the name held in the address's ShipStation Ship From Location custom field, which your order source populates; see the ShipStation Installation Instructions. The lookup runs whether or not Enable Multi Address Shipment is on, because a single-destination shipment needs the location just as much.

GetStoreIdByNameAsync

What it does: Looks up the ShipStation identifier of a store by its name, for the store a shipment and its sales order are filed under.

Signature: Task<string> GetStoreIdByNameAsync(string name)

How to call it: await GetStoreIdByNameAsync(name)

Parameter

Type

Required

Default

Description

name

string

Yes

N/A

The name of the ShipStation store to look up, as shown in ShipStation under Account Settings, Selling Channels, Store Setup. Matched without regard to case.

Returns: string. The ShipStation identifier of the matching store, or null if no store has that name.

Example: "Manual Orders" returns "168630", the identifier of the store named Manual Orders.

When to use it: Use this for the Shipment_StoreId field on the shipment address collection so the sales order ShipStation creates alongside each shipment appears under the store your team works from. The shipped mapping calls it with the name held in the order's ShipStation Store custom field, which your order source populates; when that custom field is empty or matches no store, no store is sent and ShipStation uses your account's default store.

Carriers and Services

GetCarrierIdByServiceNameAsync

What it does: Looks up the ShipStation identifier of the connected carrier that offers a given carrier service, by the service's name.

Signature: Task<string> GetCarrierIdByServiceNameAsync(string serviceName)

How to call it: await GetCarrierIdByServiceNameAsync(serviceName)

Parameter

Type

Required

Default

Description

serviceName

string

Yes

N/A

The name of the ShipStation carrier service to look up, as ShipStation lists it for the connected carrier (for example, USPS First Class Mail). Matched without regard to case across every connected carrier's services.

Returns: string. The ShipStation identifier of the carrier that offers the matching service, or null if no connected carrier offers a service with that name.

Example: "USPS First Class Mail" returns "se-28529731", the identifier of the carrier offering that service.

When to use it: Use this for the Shipment_CarrierId field on the shipment address collection when you want a shipment to arrive in ShipStation with its carrier already selected. The shipped mappings leave the carrier unmapped on purpose so every shipment arrives as a Pending shipment your team completes in ShipStation; map it only after you or your MiSP have confirmed the result in a staging environment, because a shipment that arrives carrier-assigned can be labeled and charged by ShipStation automation without review.

GetServiceCodeByServiceNameAsync

What it does: Looks up the ShipStation service code of a carrier service by the service's name.

Signature: Task<string> GetServiceCodeByServiceNameAsync(string serviceName)

How to call it: await GetServiceCodeByServiceNameAsync(serviceName)

Parameter

Type

Required

Default

Description

serviceName

string

Yes

N/A

The name of the ShipStation carrier service to look up, as ShipStation lists it for the connected carrier (for example, USPS First Class Mail). Matched without regard to case across every connected carrier's services.

Returns: string. The ShipStation service code of the matching service, or null if no connected carrier offers a service with that name.

Example: "USPS First Class Mail" returns "usps_first_class_mail", the service code of that service.

When to use it: Use this together with GetCarrierIdByServiceNameAsync for the Shipment_ServiceCode field on the shipment address collection, when a shipment should arrive with its shipping service already selected. The same caution applies: the shipped mappings leave the service unmapped so shipments are completed in ShipStation, and mapping it should be confirmed in a staging environment first.

Locations

ConvertiPaaSLocationIdToShipStationId

What it does: Maps an iPaaS.com location ID to the linked ShipStation location ID.

Signature: Task<string> ConvertiPaaSLocationIdToShipStationId(object locationId)

How to call it: await ConvertiPaaSLocationIdToShipStationId(locationId)

Parameter

Type

Required

Default

Description

locationId

object

Yes

N/A

The iPaaS.com location ID to map, typically a string or numeric identifier.

Returns: string. The ShipStation location ID linked to the iPaaS.com location ID. If the lookup fails, the function raises an error.

Example: 2001 returns the ShipStation location ID mapped from that iPaaS.com location.

When to use it: Use this when a mapping references a location by its iPaaS.com ID and you need the matching ShipStation location ID.

Related Documents

Did this answer your question?