### Install and Run Shipping Elements Locally Source: https://docs.goshippo.com/docs/shippingelements/quickstart.md Commands to install project dependencies and start the development server for the Shippo Shipping Elements React demo. ```bash npm install ``` ```bash npm start ``` -------------------------------- ### Shippo API Client Library Installation (PHP) Source: https://docs.goshippo.com/docs/guides_general/api_quickstart.md Instructions for setting up the Shippo PHP client library. Users should follow the provided GitHub repository link for detailed installation steps and usage. ```php // Follow the steps in // https://github.com/goshippo/shippo-php-client ``` -------------------------------- ### Shippo API Client Library Installation (cURL) Source: https://docs.goshippo.com/docs/guides_general/api_quickstart.md Indicates that no specific client library installation is needed for making cURL requests to the Shippo API. This method is useful for direct HTTP requests. ```shell # No library needed for cURL ``` -------------------------------- ### Create Shippo Address using Java SDK Source: https://docs.goshippo.com/docs/guides_general/api_quickstart.md This Java code demonstrates creating a new address with the Shippo SDK. It requires setting the API key and then populating a HashMap with the address details before calling the `Address.create` method. Ensure you have the necessary Shippo library included in your project. ```java Shippo.setApiKey(''); HashMap addressMap = new HashMap(); addressMap.put("name", "Mr. Hippo"); addressMap.put("company", "Shippo"); addressMap.put("street1", "215 Clayton St."); addressMap.put("city", "San Francisco"); addressMap.put("state", "CA"); addressMap.put("zip", "94117"); addressMap.put("country", "US"); addressMap.put("phone", "+1 555 341 9393"); addressMap.put("email", "support@goshipppo.com"); Address createAddress = Address.create(addressMap); ``` -------------------------------- ### Create Shippo Address using C# SDK Source: https://docs.goshippo.com/docs/guides_general/api_quickstart.md This C# code snippet shows how to create a new address using the Shippo SDK for .NET. It involves initializing the `ShippoSDK` with your API token and then using the `Addresses.CreateAsync` method with an `AddressCreateRequest` object. This is an asynchronous operation. ```csharp using Shippo; using Shippo.Models.Components; ShippoSDK sdk = new ShippoSDK(apiKeyHeader: ""); Address address = await sdk.Addresses.CreateAsync( new AddressCreateRequest() { Name = "Shawn Ippotle", Company = "Shippo", Street1 = "215 Clayton St.", City = "San Francisco", State = "CA", Zip = "94117", Country = "US", Phone = "+1 555 341 9393", Email = "shippotle@shippo.com", } ); ``` -------------------------------- ### Create Shippo Address via cURL Source: https://docs.goshippo.com/docs/guides_general/api_quickstart.md This snippet demonstrates how to create a new address in your Shippo account using a cURL command. It requires your API token and specifies address details as parameters. Ensure you replace `` with your actual token. ```shell curl https://api.goshippo.com/addresses/ \ -H "Authorization: ShippoToken " \ -d name="Shawn Ippotle" \ -d company="Shippo" \ -d street1="215 Clayton St." \ -d street2="" \ -d city="San Francisco" \ -d state="CA" \ -d zip=94117 \ -d country="US" \ -d phone="+1 555 341 9393" \ -d email="shippotle@shippo.com" -d is_residential=True\ -d metadata="Customer ID 123456" ``` -------------------------------- ### Create Extended Multi-Piece Shipment via Instalabel Source: https://docs.goshippo.com/docs/shipments/multipieceshipment.md Demonstrates how to initiate an Instalabel transaction for a multi-piece shipment. Requires a carrier account ID, service level token, and setting the async flag to true. ```shell curl https://api.goshippo.com/transactions/ \ -H "Authorization: ShippoToken " \ -H "Content-Type: application/json" \ -d '{ "shipment": { "address_from": { "name": "Mr. Hippo", "street1": "215 Clayton St.", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "+1 555 341 9393", "email": "support@shippo.com" }, "address_to": { "name": "Mrs. Hippo", "street1": "965 Mission St.", "city": "San Francisco", "state": "CA", "zip": "94105", "country": "US", "phone": "+1 555 341 9393", "email": "support@shippo.com" }, "parcels": [ { "length": "5", "width": "5", "height": "5", "distance_unit": "in", "weight": "2", "mass_unit": "lb" }, { "length": "10", "width": "10", "height": "10", "distance_unit": "in", "weight": "2", "mass_unit": "lb" }, { "length": "5", "width": "10", "height": "2", "distance_unit": "in", "weight": "2", "mass_unit": "lb" } ] }, "carrier_account": "b741b99f95e841639b54272834bc478c", "servicelevel_token": "ups_ground", "async":true }' ``` -------------------------------- ### Shippo API Address Creation Success Response Source: https://docs.goshippo.com/docs/guides_general/api_quickstart.md This is an example of a successful JSON response when creating a new address via the Shippo API. It includes details about the created object, timestamps, and the address information provided. Verify your API token if your response differs. ```json { "is_complete": true, "object_created":"2022-07-09T02:19:13.174Z", "object_updated":"2022-07-09T02:19:13.174Z", "object_id":"d799c2679e644279b59fe661ac8fa488", "object_owner":"shippotle@shippo.com", "validation_results": {}, "name":"Shawn Ippotle", "company":"Shippo", "street_no": "", "street1":"215 Clayton St.", "street2":"", "street3":"", "city":"San Francisco", "state":"CA", "zip":"94117", "country":"US", "longitude": null, "latitude": null, "phone":"15553419393", "email":"shippotle@shippo.com", "is_residential":true, "metadata":"Customer ID 123456" } ``` -------------------------------- ### GET /oauth/authorize Source: https://docs.goshippo.com/docs/oauth_integrations/oauth.md Initiates the OAuth flow by redirecting the user to the Shippo authorization page. ```APIDOC ## GET /oauth/authorize ### Description Redirect your users to this endpoint to initiate the OAuth flow. This allows users to log in, register, or grant your platform access to their Shippo account. ### Method GET ### Endpoint https://goshippo.com/oauth/authorize ### Parameters #### Query Parameters - **response_type** (string) - Required - Must be set to "code". - **client_id** (string) - Required - Your unique partner ID provided by Shippo. - **scope** (string) - Required - Set to "*" for full API access. - **state** (string) - Required - A random string generated by your application to prevent CSRF attacks. - **utm_source** (string) - Optional - An ID for your application provided by Shippo. ### Request Example https://goshippo.com/oauth/authorize?response_type=code&client_id=YOUR_PARTNER_ID&scope=*&state=YOUR_RANDOM_STRING ### Response #### Success Response (302) Redirects the user to the Shippo OAuth interface. ``` -------------------------------- ### Get Carrier Registration Status Source: https://docs.goshippo.com/shippoapi/public-api/customs-declarations/customsdeclaration Retrieves the status of a carrier account registration. This helps in tracking the progress of a new carrier account setup. ```HTTP GET /carrier_accounts/reg-status ``` -------------------------------- ### Create Instalabel with Python Source: https://docs.goshippo.com/docs/guides_general/generate_shipping_label.md This Python code uses the Shippo SDK to create a shipping label via the Instalabel feature. It defines sender and recipient addresses, parcel details, and then calls the transactions.create method with the shipment, carrier account, and service level token. Replace '' with your actual Shippo API token. ```python import shippo from shippo.models import components shippo_sdk = shippo.Shippo(api_key_header="") address_from = components.AddressCreateRequest( name="Shawn Ippotle", company="Shippo", street1="215 Clayton St.", city="San Francisco", state="CA", zip="94117", country="US", phone="+1 555 341 9393", email="shippotle@shippo.com" ) address_to = components.AddressCreateRequest( name="Mr Hippo", street1="Broadway 1", city="New York", state="NY", zip="10007", country="US", phone="+1 555 341 9393", email="mrhippo@shippo.com", metadata="Priority Customer" ) parcel = components.ParcelCreateRequest( length="5", width="5", height="5", distance_unit=components.DistanceUnitEnum.IN, weight="2", mass_unit=components.WeightUnitEnum.LB ) shipment = components.ShipmentCreateRequest( address_from=address_from, address_to=address_to, parcels=[parcel], ) transaction = shippo_sdk.transactions.create( components.InstantTransactionCreateRequest( shipment=shipment, carrier_account="b741b99f95e841639b54272834bc478c", servicelevel_token="usps_priority" ) ) ``` -------------------------------- ### GET /shippo-oauth-redirect Source: https://docs.goshippo.com/docs/oauth_integrations/oauth.md The callback endpoint on your server that receives the authorization code after the user completes the OAuth flow. ```APIDOC ## GET /shippo-oauth-redirect ### Description This is your application's callback URL. After the user grants permission, Shippo redirects them here with an authorization code or an error message. ### Method GET ### Endpoint [Your Callback URL] ### Parameters #### Query Parameters - **code** (string) - Required (on success) - The authorization code used to fetch user credentials. - **state** (string) - Required - The random string passed in the initial request, used for CSRF verification. - **error** (string) - Optional - Returned if the user denies the request. - **error_description** (string) - Optional - Human-readable description of the error. ### Request Example https://www.example-app.com/shippo-oauth-redirect?code=AUTH_CODE_HERE&state=my_random_string_def456 ### Response #### Success Response (200) - **code** (string) - The authorization code to be exchanged for an access token. ``` -------------------------------- ### Create Instalabel with PHP Source: https://docs.goshippo.com/docs/guides_general/generate_shipping_label.md This PHP code snippet utilizes the Shippo library to create a shipping label using the Instalabel feature. It sets up the API key, defines the 'from' and 'to' addresses, and parcel details, then creates a transaction with the specified shipment, carrier account, and service level token. Replace '' with your actual Shippo API token. ```php require_once('lib/Shippo.php'); Shippo::setApiKey(""); $fromAddress = array( 'name' => 'Shawn Ippotle', 'company' => 'Shippo', 'street1' => '215 Clayton St.', 'city' => 'San Francisco', 'state' => 'CA', 'zip' => '94117', 'country' => 'US', 'phone' => '+1 555 341 9393', 'email' => 'shippotle@shippo.com' ); $toAddress = array( 'name' => 'Mr Hippo"', 'company' => '', 'street1' => 'Broadway 1', 'street2' => '', 'city' => 'New York', 'state' => 'NY', 'zip' => '10007', 'country' => 'US', 'phone' => '+1 555 341 9393', 'email' => 'mrhippo@shippo.com' ); $parcel = array( 'length'=> '5', 'width'=> '5', 'height'=> '5', 'distance_unit'=> 'in', 'weight'=> '2', 'mass_unit'=> 'lb', ); $shipment = array( 'address_from'=> $fromAddress, 'address_to'=> $toAddress, 'parcels'=> array($parcel), ); $transaction = Shippo_Transaction::create( array( 'shipment' => $shipment, 'carrier_account' => 'b741b99f95e841639b54272834bc478c', 'servicelevel_token' => 'usps_priority', ) ); ``` -------------------------------- ### GET /carrier_accounts Source: https://docs.goshippo.com/docs/carriers/integration_guides/colissimo/create_an_account.md Retrieves the details and object_id for a specific carrier account enabled on the Shippo platform. ```APIDOC ## GET /carrier_accounts ### Description Retrieves the carrier account details, including the object_id, for a specified carrier. This is used to reference the carrier in future shipping transactions. ### Method GET ### Endpoint https://api.goshippo.com/carrier_accounts/ ### Parameters #### Query Parameters - **carrier** (string) - Required - The slug of the carrier (e.g., 'colissimo') ### Request Example ```bash curl --location --request GET 'https://api.goshippo.com/carrier_accounts?carrier=colissimo' \ --header 'Authorization: ShippoToken shippo_live_******' \ --header 'Content-Type: application/json' ``` ### Response #### Success Response (200) - **object_id** (string) - Unique identifier for the carrier account - **carrier** (string) - The carrier slug - **active** (boolean) - Whether the account is enabled #### Response Example { "carrier": "colissimo", "object_id": "4a4dfb5425ea41b6be2e851306284bf5", "active": true, "is_shippo_account": true } ``` -------------------------------- ### Create Instalabel with TypeScript Source: https://docs.goshippo.com/docs/guides_general/generate_shipping_label.md This TypeScript code demonstrates creating a shipping label using Shippo's Instalabel feature. It initializes the Shippo client, defines the sender and recipient addresses, and parcel details. The transaction is then created using the `create` method with the necessary shipment, carrier account, and service level token. Replace '' with your actual Shippo API token. ```typescript const shippo = new Shippo({apiKeyHeader: ''}); const addressFrom: AddressCreateRequest = { name: "Shawn Ippotle", company: "Shippo", street1: "215 Clayton St.", city: "San Francisco", state: "CA", zip: "94117", country: "US", phone: "+1 555 341 9393", email: "shippotle@shippo.com", }; const addressTo: AddressCreateRequest = { name: "Mr Hippo", company: "", street1: "Broadway 1", street2: "", city: "New York", state: "NY", zip: "10007", country: "US", phone: "+1 555 341 9393", email: "mrhippo@shippo.com", metadata: "Hippos dont lie" }; const parcel: ParcelCreateRequest = { length: "5", width: "5", ``` -------------------------------- ### Create Manifest with Direct Address Parameters Source: https://docs.goshippo.com/docs/manifests_and_pickups/manifestandscanforms.md This cURL example shows how to create a manifest by directly providing the address details for `address_from` instead of using an object ID. This method is useful when the address is not pre-saved in Shippo. Ensure all required address fields are included. ```cURL curl https://api.goshippo.com/manifests/ \ -H "Authorization: ShippoToken shippo_test_831a7a042784f523b95db65444e6e084b636764b"\ -H "Content-Type: application/json"\ -d '{ \ "carrier_account": "b741b99f95e841639b54272834bc478c", \ "shipment_date": "2014-05-16T23:59:59Z", \ "address_from": { \ "name": "Mr Shippo", \ "street1": "765 W Adams St", \ "street2": "", \ "city": "Chicago", \ "state": "IL", \ "zip": "60661", \ "country": "US", \ "phone": "123454656677", \ "email": "mrshippo@shippo.com" \ }, \ "transactions": [ \ "64bba01845ef40d29374032599f22588", \ "c169aa586a844cc49da00d0272b590e1" \ ], \ "async": true \ }' ``` -------------------------------- ### GET /shippo-accounts/ Source: https://docs.goshippo.com/docs/shippingelements/auth.md Retrieves a list of all Managed Shippo Accounts to obtain the object_id required for white label authorization. ```APIDOC ## GET /shippo-accounts/ ### Description Retrieve a list of all Managed Shippo Accounts associated with your platform account. The response includes the `object_id` necessary for generating JWTs for specific users. ### Method GET ### Endpoint https://api.goshippo.com/shippo-accounts/ ### Parameters #### Headers - **Authorization** (string) - Required - "ShippoToken " ### Response #### Success Response (200) - **object_id** (string) - The unique identifier for the managed Shippo account. ### Response Example { "results": [ { "object_id": "e0b382dc7d754c0ca6358c09d5d2bdf7", "name": "Customer Account" } ] } ``` -------------------------------- ### Shippo API Authentication Header Example Source: https://docs.goshippo.com/docs/oauth_integrations/oauth.md This example shows how to authenticate Shippo API requests on behalf of a user using a Bearer access token in the Authorization header. It also includes setting the Content-Type to application/json. The access token is obtained from the token exchange process. ```shell curl https://api.goshippo.com/shipments/\ -H "Authorization: Bearer "\ -H "Content-Type: application/json"\ -d "{...}" ``` -------------------------------- ### Untitled Source: https://docs.goshippo.com/shippoapi/public-api/customs-declarations/customsdeclaration No description -------------------------------- ### Build and Configure Local Development Environment Source: https://docs.goshippo.com/docs/guides_general/mcpserver.md Steps to build the server from source and configure it for local development. Includes the JSON configuration structure required for MCP client integration. ```bash npm install npm run build ``` ```json { "mcpServers": { "shippo-dev": { "command": "node", "args": [ "/ABSOLUTE/PATH/TO/REPO/bin/mcp-server.js", "start", "--api-key-header", "ShippoToken YOUR_SHIPPO_API_KEY", "--shippo-api-version", "2018-02-08" ] } } } ``` -------------------------------- ### Example API Response Source: https://docs.goshippo.com/docs/shippingelements/auth.md Represents the expected JSON response structure when a valid JWT is provided to the carrier parcel templates endpoint. ```json [ { "name": "FedEx® Small Box (S1)", "token": "FedEx_Box_Small_1", "carrier": "FedEx", "is_variable_dimensions": false, "length": "12.375", "width": "10.875", "height": "1.5", "distance_unit": "in" } ] ``` -------------------------------- ### Get Carrier Registration Status (JSON Response) Source: https://docs.goshippo.com/shippoapi/public-api/carrier-accounts/carrieraccount Example JSON response indicating the registration status of a carrier account. It includes identifiers, owner information, timestamps, and the current status. ```json { "carrier_account": "99dc410d295b4a168993cc38809cb123", "object_created": "2019-08-24T14:15:22Z", "object_owner": "tom@gmail.com", "object_updated": "2019-08-24T14:15:22Z", "status": "PENDING_TERMS" } ``` -------------------------------- ### POST /transactions/ Source: https://docs.goshippo.com/docs/shipments/dropoffpickup.md Creates an Instalabel for a drop-off shipment. Requires carrier object ID and a service level token that supports drop-off. ```APIDOC ## POST /transactions/ ### Description Creates an Instalabel for a drop-off shipment. Requires carrier object ID and a service level token that supports drop-off. ### Method POST ### Endpoint https://api.goshippo.com/transactions/ ### Parameters #### Request Body - **shipment** (object) - Required - Details of the shipment including sender and receiver addresses and parcel information. - **address_from** (object) - Required - Sender's address details. - **address_to** (object) - Required - Receiver's address details. - **parcels** (array) - Required - An array of parcel objects. - **weight** (string) - Required - The weight of the parcel. - **length** (string) - Required - The length of the parcel. - **width** (string) - Required - The width of the parcel. - **height** (string) - Required - The height of the parcel. - **distance_unit** (string) - Required - The unit of measurement for distance (e.g., "in"). - **mass_unit** (string) - Required - The unit of measurement for mass (e.g., "lb"). - **carrier_account** (string) - Required - The carrier object ID. - **servicelevel_token** (string) - Required - The service level token that supports drop-off. ### Request Example ```json { "shipment": { "address_from": { "name": "Mr. Hippo", "street1": "215 Clayton St.", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "4151234567", "email": "mrhippo@goshippo.com", "is_residential": null }, "address_to": { "name": "Mrs. Hippo", "street1": "1092 Indian Summer Ct", "city": "San Jose", "state": "CA", "zip": "95122", "country": "US", "phone": "4159876543", "email": "mrshippo@goshippo.com" }, "parcels": [{ "weight": "1", "length": "10", "width": "10", "height": "10", "distance_unit": "in", "mass_unit": "lb" }] }, "carrier_account": "2c79a675977d459ca7b74e003ed97854", "servicelevel_token": "usps_ground_advantage" } ``` ### Response #### Success Response (200) - **object_state** (string) - The state of the created object. - **status** (string) - The status of the transaction. - **object_created** (string) - The timestamp when the object was created. - **object_updated** (string) - The timestamp when the object was last updated. - **object_id** (string) - The unique identifier for the object. - **object_owner** (string) - The email of the object owner. - **test** (boolean) - Indicates if the transaction was a test. - **rate** (string) - The ID of the associated rate. - **tracking_number** (string) - The tracking number for the shipment. - **tracking_status** (string) - The current tracking status. - **eta** (string) - The estimated time of arrival. - **tracking_url_provider** (string) - The URL to track the shipment on the provider's website. - **label_url** (string) - The URL to download the shipping label. - **commercial_invoice_url** (string) - The URL to download the commercial invoice, if applicable. - **messages** (array) - An array of messages related to the transaction. - **order** (object) - Order details, if applicable. - **metadata** (string) - Any metadata associated with the transaction. - **parcel** (string) - The ID of the associated parcel. - **billing** (object) - Billing information. - **qr_code_url** (string) - The URL for a QR code, if applicable. - **created_by** (object) - Information about who created the object. #### Response Example ```json { "object_state": "VALID", "status": "SUCCESS", "object_created": "2024-06-25T21:42:19.048Z", "object_updated": "2024-06-25T21:42:24.926Z", "object_id": "c8b2789b5e66420186450167eeb761f9", "object_owner": "mrhippo@goshippo.com", "test": false, "rate": "37ccdc9c210940cb8c554610207b553d", "tracking_number": "92055901755477000000000015", "tracking_status": "PRE_TRANSIT", "eta": null, "tracking_url_provider": "https://tools.usps.com/go/TrackConfirmAction_input?origTrackNum=92055901755477000000000015", "label_url": "https://shippo-delivery-east.s3.amazonaws.com/c8b2789b5e66420dffdfsdfgfg167eeb761f9.pdf", "commercial_invoice_url": null, "messages": [], "order": null, "metadata": "usps_rate_qr_code_success", "parcel": "27a76dad79a84655add8eda8866b397e", "billing": { "payments": [] }, "qr_code_url": null, "created_by": { "first_name": "Mr.", "last_name": "Hippo", "username": "mrhippo@goshippo.com" } } ``` ``` -------------------------------- ### Full Shippo Integration with Label Purchase in HTML Source: https://docs.goshippo.com/docs/shippingelements/install.md A complete HTML example demonstrating how to initialize the Shippo embeddable client and then use the shippo.labelPurchase() method when a button is clicked. This includes setting up the necessary meta tags, including the Shippo script, and handling the button event. ```html Web Application
``` -------------------------------- ### Get Carrier Registration Status (cURL Request) Source: https://docs.goshippo.com/shippoapi/public-api/carrier-accounts/carrieraccount Example cURL command to retrieve the registration status for a specific carrier account. It requires an API key and optionally accepts a specific API version. ```curl curl -i -X GET \ 'https://api.goshippo.com/carrier_accounts/reg-status?carrier=ups' \ -H 'Authorization: YOUR_API_KEY_HERE' \ -H 'SHIPPO-API-VERSION: 2018-02-08' ``` -------------------------------- ### Handle OAuth Redirect and Error Responses Source: https://docs.goshippo.com/docs/oauth_integrations/oauth.md Examples of the redirect URL structure received by your application after the user completes or denies the OAuth flow. It includes the authorization code or error details and the state parameter for validation. ```url https://www.example-app.com/shippo-oauth-redirect?code=AUTH_CODE_HERE&state=my_random_string_def456 ``` ```url https://www.example-app.com/shippo-oauth-redirect?error=access_denied&error_description=The%20user%20denied%20your%20request&state=my_random_string_def456 ``` -------------------------------- ### Create Shipment Request with Shippo SDK Source: https://docs.goshippo.com/docs/shipments/shippinginsurance.md Demonstrates how to define shipment components including addresses, parcels, and insurance, and then execute the shipment creation request. This process is shown for both Java using HashMaps and C# using strongly-typed SDK models. ```java HashMap addressToMap = new HashMap(); addressToMap.put("name", "Mr Hippo"); addressToMap.put("company", "Shippo"); addressToMap.put("street1", "215 Clayton St."); addressToMap.put("city", "San Francisco"); addressToMap.put("state", "CA"); addressToMap.put("zip", "94117"); addressToMap.put("country", "US"); addressToMap.put("phone", "+1 555 341 9393"); addressToMap.put("email", "mrhippo@goshipppo.com"); HashMap parcelMap = new HashMap(); parcelMap.put("length", "5"); parcelMap.put("width", "5"); parcelMap.put("height", "5"); parcelMap.put("distance_unit", "in"); parcelMap.put("weight", "2"); parcelMap.put("mass_unit", "lb"); HashMap shipmentMap = new HashMap(); shipmentMap.put("address_to", addressToMap); shipmentMap.put("parcels", parcelMap); shipmentMap.put("async", false); Shipment shipment = Shipment.create(shipmentMap); ``` ```csharp using Shippo; using Shippo.Models.Components; ShippoSDK sdk = new ShippoSDK(apiKeyHeader: ""); AddressTo addressTo = AddressTo.CreateAddressCreateRequest(new AddressCreateRequest() { Name = "Mr Hippo", Street1 = "Broadway 1", City = "New York", State = "NY", Zip = "10007", Country = "US" }); Shipment shipment = await sdk.Shipments.CreateAsync(new ShipmentCreateRequest() { AddressTo = addressTo, Async = false }); ``` -------------------------------- ### Create an Instalabel Shipment Source: https://docs.goshippo.com/docs/shipments/dropoffpickup.md Demonstrates how to create an Instalabel for a drop-off shipment by sending a POST request to the transactions endpoint. Requires a valid carrier account ID and a supported service level token. ```shell curl --location 'https://api.goshippo.com/transactions/' \ --header 'Authorization: ShippoToken ' \ --header 'Content-Type: application/json'\ --data-raw '{ "shipment": { "address_from": { "name": "Mr. Hippo", "street1": "215 Clayton St.", "city": "San Francisco", "state": "CA", "zip": "94117", "country": "US", "phone": "4151234567", "email": "mrhippo@goshippo.com", "is_residential": null }, "address_to": { "name": "Mrs. Hippo", "street1": "1092 Indian Summer Ct", "city": "San Jose", "state": "CA", "zip": "95122", "country": "US", "phone": "4159876543", "email": "mrshippo@goshippo.com" }, "parcels": [{ "weight": "1", "length": "10", "width": "10", "height": "10", "distance_unit": "in", "mass_unit": "lb" }] }, "carrier_account": "2c79a675977d459ca7b74e003ed97854", "servicelevel_token": "usps_ground_advantage" }' ``` -------------------------------- ### Create Shipment Transaction in C# Source: https://docs.goshippo.com/docs/guides_general/single_call.md This C# code example demonstrates creating a shipment transaction with the Shippo API. It utilizes the ShippoSDK and models like AddressCreateRequest, ParcelCreateRequest, and ShipmentCreateRequest to define shipment details. Ensure the Shippo .NET SDK is installed and your API token is correctly configured. ```csharp using Shippo; using Shippo.Models.Components; ShippoSDK sdk = new ShippoSDK(apiKeyHeader: ""); AddressFrom addressFrom = AddressFrom.CreateAddressCreateRequest( new AddressCreateRequest() { Name = "Shawn Ippotle", Company = "Shippo", Street1 = "215 Clayton St.", City = "San Francisco", State = "CA", Zip = "94117", Country = "US", Phone = "+1 555 341 9393", Email = "shippotle@shippo.com", } ); AddressTo addressTo = AddressTo.CreateAddressCreateRequest( new AddressCreateRequest() { Name = "Mr Hippo", Company = "", Street1 = "Broadway 1", Street2 = "", City = "New York", State = "NY", Zip = "10007", Country = "US", Phone = "+1 555 341 9393", Email = "mrhippo@shippo.com", Metadata = "Hippos dont lie", } ); Shippo.Models.Components.Parcels parcel = Shippo.Models.Components.Parcels.CreateParcelCreateRequest( new ParcelCreateRequest() { Length = "5", Width = "5", Height = "5", DistanceUnit = DistanceUnitEnum.In, Weight = "2", MassUnit = WeightUnitEnum.Lb, } ); ShipmentCreateRequest shipmentCreateRequest = new ShipmentCreateRequest() { AddressFrom = addressFrom, AddressTo = addressTo, Parcels = new List() { parcel }, }; Transaction transaction = await sdk.Transactions.CreateAsync( CreateTransactionRequestBody.CreateInstantTransactionCreateRequest( new InstantTransactionCreateRequest() { Shipment = shipmentCreateRequest, CarrierAccount = "b741b99f95e841639b54272834bc478c", ServicelevelToken = ServiceLevelUSPSEnum.UspsPriority.Value(), } ) ); ``` -------------------------------- ### OAuth Authorization URL with Redirect URI Source: https://docs.goshippo.com/docs/oauth_integrations/oauth.md This JSON example demonstrates the structure of an OAuth authorization URL, including the 'redirect_uri' query parameter. This parameter allows you to specify a custom callback URL for users after they log into their Shippo account, which is useful for development and testing. ```json https://goshippo.com/oauth/authorize?response_type=code&client_id=YOUR_PARTNER_ID&scope=*&state=YOUR_RANDOM_STRING&redirect_uri=https://mysite.com/ ``` -------------------------------- ### Create Instalabel with cURL Source: https://docs.goshippo.com/docs/guides_general/generate_shipping_label.md This cURL command demonstrates how to create a shipping label using Shippo's Instalabel feature. It sends a POST request to the Transactions endpoint with shipment details, carrier account, and service level token. Ensure you replace '' with your actual Shippo API token. ```shell curl https://api.goshippo.com/transactions/ \ -H "Authorization: ShippoToken " \ -H "Content-Type: application/json" \ -d '{ \ "shipment": { \ "address_from": { \ "name": "Mr. Hippo", \ "street1": "215 Clayton St.", \ "city": "San Francisco", \ "state": "CA", \ "zip": "94117", \ "country": "US", \ "phone": "+1 555 341 9393", \ "email": "support@shippo.com" \ }, \ "address_to": { \ "name": "Mrs. Hippo", \ "street1": "965 Mission St.", \ "city": "San Francisco", \ "state": "CA", \ "zip": "94105", \ "country": "US", \ "phone": "+1 555 341 9393", \ "email": "support@shippo.com" \ }, \ "parcels": [{ \ "length": "5", \ "width": "5", \ "height": "5", \ "distance_unit": "in", \ "weight": "2", \ "mass_unit": "lb" \ }] \ }, \ "carrier_account": "b741b99f95e841639b54272834bc478c", \ "servicelevel_token": "usps_priority" \ }' ```