The API Key used to authenticate with the ShipGenius OMS server.
You can create one through the Connected Apps portal.
The server to connect to.
environment (recommended)Specify the environment key with a ServerEnvironment value to connect to a standard ShipGenius server
Options are:
PRODUCTION = Actual server to purchase real labelsSANDBOX = Simple testing server with mock responsesDEVELOPMENT = More complex testing environment with semi-persistent data, but still no real money or labelsExample
{ environment: ServerEnvironment.SANDBOX }
url (not recommended)Specify the url key with a URL
to connect to a server at a custom URL.
Useful if you need to connect indirectly, or to a staging server.
URL should not contain a trailing slash or version number.
URL should contain a protocol (i.e. http:// or https://).
Example
{ url: "http://localhost:8000" }
Optionaloptions: ShipGeniusOmsClientConstructorOptionsOptional extra options
Additional options for the connection, such as the api version.
None of these arguments are required.
import ShipGeniusOmsClient, { ServerEnvironment } from "@shipgenius/oms/client";
const client = new ShipGeniusOmsClient(
"f7f4d30c26ac2537e1db50da3dbd990a0261617f857c093d3a261b6b2d27685e",
{ environment: ServerEnvironment.SANDBOX },
{ version: "latest" }, // not necessary since "latest" is the default
);
Protected Internal_urlThe base URL requests are being sent to
Protected_versionThe version of the API to use
Protectedapi_The user's App API Token
The base URL requests are being sent to
The version of the API being used
Purchase a shipping label
The shipment or shipments to make
The carrier service to purchase.
If set to null, each request must specify an override
in LabelCreationInput.override_service.
Optionaloptions: {Extra, optional, parameters for the label creation and returned information.
Optionalas_data_url?: booleanWhether to return the image as a base64 data: uri (true),
or a base64 encoded bytes string (false)
Optionalformat?: FormatThe format to return label images in.
Only one format can be specified, as converting image formats is a larger-than-typical workload.
If you need the image in multiple formats, you can run a custom query via runGraphql.
Optionalpayment_id?: null | stringThe id of the payment method to use for this batch.
Set to null to use your default payment method.
Optionalweight_unit?: WeightUnitThe unit of measure to return weights in
Information about the batch of purchased labels.
Get cost and transit estimates for a domestic (USA to USA) shipment
The package(s) to rate
The carrier service(s) to get rates for
Optionaloptions: { save_rates?: boolean; weight_unit: WeightUnit }Additional options for the request
Optionalsave_rates?: booleanIf set to true, the returned rates will have have the rate_id set.
You can use this returned id to purchase a label at the rated price for the rated service
The unit to return weights in
A list of rate information for each package, in the order they were input
The return is a list of rated packages, each of which has a rates list containing the actual rates
client.HttpError if the response is not ok
client.GraphqlError if the response contains an errors key
Fetch a list of carriers supported by the API
client.HttpError
if response is not ok
Fetch a list of carrier services supported by the API
client.HttpError if response is not ok
Get tracking information for a shipped package
The label to get tracking information for
Information about the shipment of the package
client.HttpError if the response is not ok
client.GraphqlError if the response contains an errors key
Rate and ship packages in a single API call.
Specify the services to consider for shipping and rules for how to select a service. The best service according to those rules will be selected for each shipment.
The shipment or shipments to purchase shipping labels for
The services to rate and rules for selecting the best
Optionaloptions: {Additional options for controlling the purchase and response
Optionalas_data_url?: booleanWhether to return the image as a base64 data: uri (true),
or a base64 encoded bytes string (false)
Optionalformat?: FormatThe format to return label images in.
Only one format can be specified, as converting image formats is a larger-than-typical workload.
If you need the image in multiple formats, you can run a custom query via runGraphql.
Optionalpayment_id?: null | stringThe id of the payment method to use for this batch.
Set to null to use your default payment method.
Optionalweight_unit?: WeightUnitThe unit of measure to return weights in
Information about the batch of purchased labels
Recover a lost label using the transaction if provided when the label was initially created.
This mutation is designed for rare scenarios, such as a lost connection or unexpected crash during the label creation process.
For further assistance, contact us at info@shipgeni.us
The LabelCreationInput.transaction_id or DomesticRateAndShipInput.transaction_id used when creating the label you want to recover
Optionaloptions: {Additional options for configuring the recovery and the returned label
Optionalas_data_url?: booleanWhether to return the image as a base64 data: uri (true),
or a base64 encoded bytes string (false)
Optionalformat?: FormatThe format to return label images in.
Only one format can be specified, as converting image formats is a larger-than-typical workload.
If you need the image in multiple formats, you can run a custom query via runGraphql.
Optionalpayment_id?: null | stringThe payment ID to use to pay for the label if payment was not successful initially.
The payment method will not be charged if the label was already paid for.
If something goes wrong and you get double-charged for a label, contact info@shipgeni.us as soon as possible to resolve the issue.
Optionalweight_unit?: WeightUnitThe unit of measure to return weights in
the recovered label
Run an arbitrary GraphQL query on the connected API server.
The GraphQL query (or mutation) to run
Optionalvariables: JsonObjectThe variables to pass into the query
The data field of the query response
client.HttpError if the response is not ok
client.GraphqlError if the response contains an errors key
Request that the list of subscribers recieve notifications about tracking updates for the specified shipment
The shipment to subscribe to updates for
A list of people to notify about updates
a list of boolean values indicating whether the subscriptions were successful, in the same order as the input.
client.HttpError if the response is not ok
client.GraphqlError if the response contains an errors key
Validate and correct address(es) against the USPS database
The address(es) to validate
Optionaloptions: { zip_plus_four?: boolean }Additional options to control the response
Optionalzip_plus_four?: booleanWhether to include ZIP+4 extensions on returned ZIP Codes as opposed to the plain 5-digit ZIP Code
A list of validated address and/or errors in the same order as the input
client.HttpError if the response is not ok
client.GraphqlError if the response contains an errors key
Void the specified label and request a refund if applicable
The label to void
The success status of the void
client.HttpError if the response is not ok
client.GraphqlError if the response contains an errors key
A client for connecting to the ShipGenius OMS API and running API requests.