> ## Documentation Index
> Fetch the complete documentation index at: https://docs.goshippo.com/llms.txt
> Use this file to discover all available pages before exploring further.

<AgentInstructions>

## Submitting Feedback

If you encounter incorrect, outdated, or confusing documentation on this page, submit feedback:

POST https://docs.goshippo.com/feedback

```json
{
  "path": "/api-reference/batches/remove-shipments-from-a-batch",
  "feedback": "Description of the issue"
}
```

Only submit feedback when you have something specific and actionable to report.

</AgentInstructions>

# Remove shipments from a batch

> Removes shipments from an existing batch shipment.



## OpenAPI

````yaml /spec/shippoapi/public-api.yaml post /batches/{BatchId}/remove_shipments
openapi: 3.1.0
info:
  title: Shippo external API.
  version: '2018-02-08'
  x-logo:
    url: https://docs.goshippo.com/images/shippo-logo.svg
  contact:
    name: Shippo Developer Platform
    url: https://goshippo.com/contact/
  description: Use this API to integrate with the Shippo service
servers:
  - url: https://api.goshippo.com
security:
  - APIKeyHeader: []
tags:
  - name: Overview
    description: >-
      <p style="text-align: center; background-color: #F2F3F4; padding: 16px
      24px; border-radius: 4px;">
        First-time users and those looking for specific integration tutorials,
        <a href="/shippoapi/public-api/overview">see our full API documentation and guides.</a><br>
        Download the <a href="/spec/shippoapi/public-api.yaml">API Specification yaml file</a>
      </p>


      <h3>API Resources</h3>

      All API URLs listed in this documentation are relative to
      <b>https://api.goshippo.com/</b>.


      For example, the `/addresses/` resource is reachable at
      `https://api.goshippo.com/addresses/`.



      <h3>Authentication</h3>

      The API requires Shippo's token HTTP Authentication with your Shippo token
      (live or test). 


      In order to authenticate properly, please put `Authorization: ShippoToken
      <token>` in your header. You can find your token on the 

      <a href="https://goshippo.com/user/apikeys/">Shippo API settings page</a>.




      For more information about authentication and test mode, 

      <a
      href="https://docs.goshippo.com/docs/guides_general/authentication/">please
      visit our Authentication guide</a>.


      The API is available via Secure Socket Layer (SSL) only. All requests to
      the Shippo API must use TLS version 1.2 or higher.


      <h3>Request & Response Data</h3>

      Request data is passed to the API by <b>POSTing JSON objects</b> with the
      appropriate key/value-pairs to the respective 

      resource. The documentation for each API resource contains more details on
      the values accepted by a given resource.


      Response data also formatted as JSON object. You can specify how many
      results per page are to be returned. For instance, 

      `/rates/?results=25` will return up to 25 results.


      <h3>REST & Disposable Objects</h3>

      The Shippo API is built around <a
      href="http://en.wikipedia.org/wiki/Representational_State_Transfer">REST
      principles</a>. 

      Use POST requests to create objects, GET requests to retrieve objects, and
      PUT requests to update objects.


      Only the Carrier Accounts object can be updated via PUT requests. All
      other objects such as Addresses, Parcels, 

      Shipments, Rates, Transactions, Refunds, Customs Items, and Customs
      Declarations are disposable. This means that 

      once you have created an object, you cannot change it. Instead, create a
      new one with the desired values.


      <h3>API Version</h3>


      This reference guide supports the Shippo API version: `2018-02-08` . 


      To see reference guides for older API versions, see our <a
      href="https://docs.goshippo.com/docs/guides_general/legacy_reference/">legacy
      reference guide</a>. 

      For more information about Shippo API versions, see our <a
      href="https://docs.goshippo.com/docs/api_concepts/apiversioning/">API
      versions guide</a>.
  - name: Addresses
    description: >-
      Addresses are the locations a parcel is being shipped **from** and **to**.
      They represent company and residential places. Among other things, you can
      use address objects to create shipments, calculate shipping rates, and
      purchase shipping labels.
  - name: Parcels
    description: >-
      A parcel is an item you are shipping. The parcel object includes details
      about its physical make-up of the parcel. It includes dimensions and
      weight that Shippo uses to calculate rates.
  - name: Shipments
    description: >-
      A shipment is the act of transporting goods. A shipment object contains
      **to** and **from** addresses, and the parcel details that you are
      shipping. You can use the shipment object to retrieve shipping rates and
      purchase a shipping label.
  - name: Rates
    description: >-
      A rate is the cost to ship a parcel from a carrier. The rate object
      details the service level including the cost and transit time. 
  - name: Transactions
    x-displayName: Transactions (shipping labels)
    description: >-
      A transaction is the purchase of a shipping label from a shipping provider
      for a specific service. You can print purchased labels and used them to
      ship a parcel with a carrier, such as USPS or FedEx.
  - name: Customs Items
    description: >-
      Customs declarations are relevant information, including one or multiple
      customs items, you need to provide for customs clearance for your
      international shipments.
  - name: Customs Declarations
    description: >-
      Customs declarations are relevant information, including one or multiple
      customs items, you need to provide for 

      customs clearance for your international shipments.
  - name: Refunds
    description: >-
      Refunds are reimbursements for successfully created but unused shipping
      labels or other charges.
  - name: Manifests
    description: >-
      A manifest is a single-page document with a barcode that carriers can scan
      to accept all packages into transit without the need to scan each item
      individually.

      They are close-outs of shipping labels of a certain day. Some carriers
      require manifests to  process the shipments.
  - name: Carrier Accounts
    description: >-
      Carriers are the companies who deliver your package. Shippo uses Carrier
      account objects as credentials to retrieve shipping rates and purchase
      labels from shipping Carriers.
  - name: Webhooks
    description: >-
      Webhooks are a way for Shippo to notify your application when a specific
      event occurs. For example, when a label is purchased or when a shipment
      tracking status has changed. You can use webhooks to trigger actions in
      your application, such as sending an email or updating a database.
  - name: Tracking Status
    description: >-
      <p style="text-align: center; background-color: #F2F3F4;"></br>

      If you purchased your shipping label through Shippo, you can also get all
      the tracking details of your Shipment 

      from the <a href="/shippoapi/public-api/transactions">Transaction</a>
      object.

      </br></br></p>

      A tracking status of a package is an indication of current location of a
      package in the supply chain. For example,  sorting, warehousing, or out
      for delivery. Use the tracking status object to track the location of your
      shipments.


      When using your <a
      href="https://docs.goshippo.com/docs/guides_general/authentication/">Test</a>
      token for tracking, you need to use Shippo's 

      predefined tokens for testing different tracking statuses. You can find
      more information in our 

      <a href="https://docs.goshippo.com/docs/tracking/tracking/">Tracking
      tutorial</a> on how to do this, and what the 

      payloads look like.      
  - name: Batches
    description: >-
      A batch is a technique for creating multiple labels at once. Use the 
      batch object to create and purchase many shipments in two API calls. After
      creating the batch, retrieve the batch to verify that all shipments are
      valid. You can add and remove shipments after you have created the batch.
      When all shipments are valid you can purchase the batch and retrieve all
      the shipping labels.
  - name: Orders
    x-displayName: Orders (beta)
    description: >-
      An order is a request from a customer to purchase goods from a merchant.

      Use the orders object to load orders from your system to the Shippo
      dashboard.

      You can use the orders object to create, retrieve, list, and manage orders
      programmatically.

      You can also retrieve shipping rates, purchase labels, and track shipments
      for each order.
  - name: Pickups
    description: >-
      A pickup is when you schedule a carrier to collect a package for delivery.

      Use Shippo’s pickups endpoint to schedule pickups with USPS and DHL
      Express for eligible shipments that you have already created.
  - name: Service Groups
    description: >-
      A service group is a set of service levels grouped together. 

      Rates at checkout uses services groups to present available shipping
      options to customers in their shopping basket.
  - name: Carrier Parcel Templates
    description: >-
      A carrier parcel template represents a package used for shipping that has
      preset dimensions defined by a carrier. Some examples of a carrier parcel
      template include USPS Flat Rate Box and Fedex Small Pak. When using a
      carrier parcel template, the rates returned may be limited to the carrier
      that provides the box. You can create user parcel templates using a
      carrier parcel template. Shippo takes the dimensions of the carrier parcel
      template but you must configure the weight.
  - name: User Parcel Templates
    description: >-
      A user parcel template represents a package used for shipping that has
      preset dimensions and attributes defined 

      by you. They are useful for capturing attributes of parcel-types you
      frequently use for shipping, allowing 

      them to be defined once and then used for many shipments. These parcel
      templates can also be used for live rates.


      User parcel templates can also be created using a carrier parcel template,
      where the dimensions will be copied from 

      the carrier presets, but the weight can be configured by you.
  - name: Rates at Checkout
    description: >-
      Rates at checkout is a tool for merchants to display up-to-date shipping
      estimates based on what's in their customers cart and where they’re
      shipping to.

      Merchants set up curated shipping options for customers in the checkout
      flow based on data in the shopping cart. The request must include the
      **to** address and item information. Optional fields are the **from**
      address and package information. If the optional fields are not included,
      the service will use the default address and/or package configured for
      rates at checkout. The response is a list of shipping options based on the
      Service Group configuration.

      (see <a href="/shippoapi/public-api/service-groups">Service Group
      configuration</a> for details).




      # Default Parcel Template

      Assign one of your user parcel templates to be the default used when
      generating Live Rates. This template will be used by default when
      generating Live Rates, unless you explicitly provide a parcel in the Live
      Rates request.
  - name: Carriers
    description: >
      |Token | Carrier name|

      |:---|:---|

      | airterra | Airterra |

      | apc_postal | APC Postal|

      | apg | APG|

      | aramex | Aramex|

      | asendia_us | Asendia US|

      | australia_post | Australia Post (also used for Startrack)|

      | axlehire | Jitsu|

      | better_trucks | BetterTrucks|

      | borderguru | BorderGuru|

      | boxberry | Boxberry|

      | bring | Bring (also used for Posten Norge)|

      | canada_post | Canada Post|

      | chronopost | Chronopost|

      | collect_plus | CollectPlus|

      | correios_br | CorreiosBR|

      | correos_espana | Correos España |

      | colissimo | Colissimo|

      | deutsche_post | Deutsche Post|

      | dhl_benelux | DHL Benelux|

      | dhl_ecommerce | DHL eCommerce|

      | dhl_express | DHL Express|

      | dhl_germany_c2c | DHL Germany C2C|

      | dhl_germany | DHL Germany|

      | dpd_de | DPD GERMANY|

      | dpd_uk | DPD UK|

      | estafeta | Estafeta|

      | fastway_australia | Aramex|

      | fedex | FedEx|

      | globegistics | Globegistics (now Asendia)|

      | gls_us | GLS US|

      | gophr | Gophr|

      | gso | GSO|

      | hermes_germany_b2c | Hermes Germany B2C|

      | hermes_uk | Evri UK |

      | hongkong_post | Hongkong Post|

      | lasership | LaserShip|

      | lso | LSO|

      | mondial_relay | Mondial Relay|

      | new_zealand_post | New Zealand Post (also used for Pace and
      CourierPost)|

      | nippon_express | Nippon Express|

      | ontrac | OnTrac|

      | parcelforce | Parcelforce|

      | passport | Passport|

      | pcf | PCF|

      | poste_italiane | Poste Italiane |

      | posti | Posti|

      | purolator | Purolator|

      | royal_mail | Royal Mail|

      | royal_mail_sf | Royal Mail Storefeeder|

      | rr_donnelley | ePost Global|

      | russian_post | Russian Post|

      | skypostal | SkyPostal|

      | stuart | Stuart|

      | swyft | Swyft|

      | uds | UDS (United Delivery Service)|

      | ups | UPS|

      | usps | USPS|

      | veho | Veho |
  - name: Service Levels
    description: >
      Service levels represent the shipping service type for each carrier. Use
      the tokens below when creating shipments.


      ## USPS Service Levels

      |Token | Service name|

      |:---|:---|

      | usps_priority | Priority Mail|

      | usps_priority_express | Priority Mail Express|

      | usps_media_mail | Media Mail (grandfathered customers only)|

      | usps_priority_mail_international | Priority Mail International|

      | usps_priority_mail_express_international | Priority Mail Express
      International|

      | usps_first_class_package_international_service | First Class Package
      International|

      | usps_ground_advantage | Ground Advantage |


      ## FedEx Service Levels

      |Token | Service name|

      |:---|:---|

      | fedex_ground | FedEx Ground®|

      | fedex_home_delivery | FedEx Home Delivery®|

      | fedex_ground_economy | FedEx Ground® Economy|

      | fedex_2_day | FedEx 2Day®|

      | fedex_2_day_am | FedEx 2Day® A.M.|

      | fedex_express_saver | FedEx Express Saver®|

      | fedex_standard_overnight | FedEx Standard Overnight®|

      | fedex_priority_overnight | FedEx Priority Overnight®|

      | fedex_first_overnight | FedEx First Overnight®|

      | fedex_international_economy | FedEx International Economy®|

      | fedex_international_priority | FedEx International Priority®|

      | fedex_international_first | FedEx International First®|

      | fedex_international_connect_plus | FedEx International Connect Plus|


      ## UPS Service Levels

      |Token | Service name|

      |:---|:---|

      | ups_standard | UPS Standard|

      | ups_ground | UPS Ground|

      | ups_saver | UPS Saver|

      | ups_3_day_select | UPS 3 Day Select|

      | ups_second_day_air | UPS 2nd Day Air|

      | ups_second_day_air_am | UPS 2nd Day Air A.M.|

      | ups_next_day_air | UPS Next Day Air|

      | ups_next_day_air_saver | UPS Next Day Air Saver|

      | ups_next_day_air_early_am | UPS Next Day Air Early A.M.|

      | ups_express | UPS Express|

      | ups_express_plus | UPS Express Plus|

      | ups_expedited | UPS Expedited|


      ## Other Supported Carriers

      Additional service levels are available for: Airterra, APC Postal, APG,
      Asendia, Australia Post, 

      Better Trucks, Canada Post, Chronopost, Colissimo, Correos España, DHL
      Express, DHL eCommerce, 

      DHL Germany, DPD DE, DPD UK, Deutsche Post, Aramex Australia,
      Globegistics, GLS US, Jitsu, LaserShip, 

      LSO, Mondial Relay, OnTrac, Parcelforce, Poste Italiane, ePost Global,
      Purolator, Royal Mail, 

      Royal Mail Storefeeder, Swyft, UDS, Veho, and Evri UK.


      See the Schemas section for complete service level lists for each carrier.
  - name: Parcel Templates
    description: >
      A predefined package used by one or multiple carriers. When a template is
      given, the parcel dimensions 

      do not have to be sent - the dimensions below will instead be used. The
      parcel weight is not affected 

      by the use of a template.


      ## FedEx Parcel Templates

      |Token | Name | Dimensions|

      |:---|:---|:---|

      | FedEx_Box_10kg | FedEx® 10kg Box | 15.81 x 12.94 x 10.19 in|

      | FedEx_Box_25kg | FedEx® 25kg Box | 54.80 x 42.10 x 33.50 in|

      | FedEx_Box_Extra_Large_1 | FedEx® Extra Large Box (X1) | 11.88 x 11.00 x
      10.75 in|

      | FedEx_Box_Extra_Large_2 | FedEx® Extra Large Box (X2) | 15.75 x 14.13 x
      6.00 in|

      | FedEx_Box_Large_1 | FedEx® Large Box (L1) | 17.50 x 12.38 x 3.00 in|

      | FedEx_Box_Large_2 | FedEx® Large Box (L2) | 11.25 x 8.75 x 7.75 in|

      | FedEx_Box_Medium_1 | FedEx® Medium Box (M1) | 13.25 x 11.50 x 2.38 in|

      | FedEx_Box_Medium_2 | FedEx® Medium Box (M2) | 11.25 x 8.75 x 4.38 in|

      | FedEx_Box_Small_1 | FedEx® Small Box (S1) | 12.38 x 10.88 x 1.50 in|

      | FedEx_Box_Small_2 | FedEx® Small Box (S2) | 11.25 x 8.75 x 2.38 in|

      | FedEx_Envelope | FedEx® Envelope | 12.50 x 9.50 x 0.80 in|

      | FedEx_Padded_Pak | FedEx® Padded Pak | 11.75 x 14.75 x 2.00 in|

      | FedEx_Pak_1 | FedEx® Large Pak | 15.50 x 12.00 x 0.80 in|

      | FedEx_Pak_2 | FedEx® Small Pak | 12.75 x 10.25 x 0.80 in|

      | FedEx_Tube | FedEx® Tube | 38.00 x 6.00 x 6.00 in|

      | FedEx_XL_Pak | FedEx® Extra Large Pak | 17.50 x 20.75 x 2.00 in|


      ## UPS Parcel Templates

      |Token | Name | Dimensions|

      |:---|:---|:---|

      | UPS_Box_10kg | Box 10kg | 410.00 x 335.00 x 265.00 mm|

      | UPS_Box_25kg | Box 25kg | 484.00 x 433.00 x 350.00 mm|

      | UPS_Express_Box | Express Box | 460.00 x 315.00 x 95.00 mm|

      | UPS_Express_Box_Large | Express Box Large | 18.00 x 13.00 x 3.00 in|

      | UPS_Express_Box_Medium | Express Box Medium | 15.00 x 11.00 x 3.00 in|

      | UPS_Express_Box_Small | Express Box Small | 13.00 x 11.00 x 2.00 in|

      | UPS_Express_Envelope | Express Envelope | 12.50 x 9.50 x 2.00 in|

      | UPS_Express_Hard_Pak | Express Hard Pak | 14.75 x 11.50 x 2.00 in|

      | UPS_Express_Legal_Envelope | Express Legal Envelope | 15.00 x 9.50 x
      2.00 in|

      | UPS_Express_Pak | Express Pak | 16.00 x 12.75 x 2.00 in|

      | UPS_Express_Tube | Express Tube | 970.00 x 190.00 x 165.00 mm|

      | UPS_Laboratory_Pak | Laboratory Pak | 17.25 x 12.75 x 2.00 in|

      | UPS_Pad_Pak | Pad Pak | 14.75 x 11.00 x 2.00 in|


      ## USPS Parcel Templates

      |Token | Name | Dimensions|

      |:---|:---|:---|

      | USPS_FlatRateCardboardEnvelope | Flat Rate Cardboard Envelope | 12.50 x
      9.50 x 0.75 in|

      | USPS_FlatRateEnvelope | Flat Rate Envelope | 12.50 x 9.50 x 0.75 in|

      | USPS_FlatRateGiftCardEnvelope | Flat Rate Gift Card Envelope | 10.00 x
      7.00 x 0.75 in|

      | USPS_FlatRateLegalEnvelope | Flat Rate Legal Envelope | 15.00 x 9.50 x
      0.75 in|

      | USPS_FlatRatePaddedEnvelope | Flat Rate Padded Envelope | 12.50 x 9.50 x
      1.00 in|

      | USPS_FlatRateWindowEnvelope | Flat Rate Window Envelope | 10.00 x 5.00 x
      0.75 in|

      | USPS_LargeFlatRateBoardGameBox | Large Flat Rate Board Game Box | 24.06
      x 11.88 x 3.13 in|

      | USPS_LargeFlatRateBox | Large Flat Rate Box | 12.25 x 12.25 x 6.00 in|

      | USPS_APOFlatRateBox | APO/FPO/DPO Large Flat Rate Box | 12.25 x 12.25 x
      6.00 in|

      | USPS_MediumFlatRateBox1 | Medium Flat Rate Box 1 | 11.25 x 8.75 x 6.00
      in|

      | USPS_MediumFlatRateBox2 | Medium Flat Rate Box 2 | 14.00 x 12.00 x 3.50
      in|

      | USPS_RegionalRateBoxA1 | Regional Rate Box A1 | 10.13 x 7.13 x 5.00 in|

      | USPS_RegionalRateBoxA2 | Regional Rate Box A2 | 13.06 x 11.06 x 2.50 in|

      | USPS_RegionalRateBoxB1 | Regional Rate Box B1 | 12.25 x 10.50 x 5.50 in|

      | USPS_RegionalRateBoxB2 | Regional Rate Box B2 | 16.25 x 14.50 x 3.00 in|

      | USPS_SmallFlatRateBox | Small Flat Rate Box | 8.69 x 5.44 x 1.75 in|

      | USPS_SmallFlatRateEnvelope | Small Flat Rate Envelope | 10.00 x 6.00 x
      4.00 in|


      ## Other Carriers

      Additional parcel templates are available for DHL eCommerce, DPD UK, and
      Aramex Australia.

      See the Schemas section for complete template lists.
  - name: Shippo Accounts
    description: >-
      Shippo Accounts are used by Shippo Platform Accounts to create and manage
      Managed Shippo Accounts. 

      Managed Shippo Accounts are headless accounts that represent your
      customers. They are opaque to your end customers, meaning customers do not
      need to create their own Shippo login or have a billing relationship with
      Shippo. 

      They can be used by marketplaces, e-commerce platforms, and third-party
      logistics providers who want to offer, seamless, built-in shipping
      functionality to their customers. See our <a
      href="https://docs.goshippo.com/docs/platformaccounts/platform_accounts/">guide</a>
      for more details.
  - name: Customs Declaration B13A Filing Option
    description: >
      B13A Option details are obtained by filing a B13A Canada Export
      Declaration via the Canadian Export Reporting System (CERS). 

      More information on <a
      href="https://www.cbsa-asfc.gc.ca/export/guide-eng.html">reporting
      commercial exports from Canada</a>.


      **Allowed values:**

      - `FILED_ELECTRONICALLY`

      - `SUMMARY_REPORTING`

      - `NOT_REQUIRED`
  - name: Customs Declaration Contents Type
    description: |
      Type of goods of the shipment.

      **Allowed values:**
      - `DOCUMENTS`
      - `GIFT`
      - `SAMPLE`
      - `MERCHANDISE`
      - `HUMANITARIAN_DONATION`
      - `RETURN_MERCHANDISE`
      - `OTHER`
  - name: Customs Declaration EEL/PFC
    description: >
      EEL / PFC type of the shipment. For most shipments from the US to CA,
      `NOEEI_30_36` is applicable; 

      for most other shipments from the US, `NOEEI_30_37_a` is applicable.


      **Allowed values:**

      - `NOEEI_30_37_a`

      - `NOEEI_30_37_h`

      - `NOEEI_30_37_f`

      - `NOEEI_30_36`

      - `AES_ITN`
  - name: Customs Declaration Incoterm
    description: >
      The incoterm reference of the shipment. FCA is available for DHL Express
      and FedEx only. 

      eDAP is available for DPD UK only. DAP is available for DHL Express and
      DPD UK.

      If expecting DAP for other carriers, please use DDU.


      **Allowed values:**

      - `DDP`

      - `DDU`

      - `FCA`

      - `DAP`

      - `eDAP`
  - name: Customs Declaration Non Delivery Option
    description: >
      Indicates how the carrier should proceed in case the shipment can't be
      delivered.


      **Allowed values:**

      - `ABANDON`

      - `RETURN`
  - name: Address Validation Source
    description: |
      Source of the address validation message.

      **Allowed values:**
      - `Shippo Address Validator`
      - `UPS`
  - name: Address Validation Codes
    description: |
      Validation result codes returned by the address validation service.

      **Allowed values:**
      - `verification_error`
      - `unknown_street`
      - `component_mismatch_error`
      - `multiple_match`
      - `sub_premise_number_invalid`
      - `sub_premise_number_missing`
      - `premise_number_invalid`
      - `premise_number_missing`
      - `box_number_invalid`
      - `box_number_missing`
      - `pmb_number_missing`
      - `postal_code_change`
      - `administrative_area_change`
      - `locality_change`
      - `dependent_locality_change`
      - `street_name_change`
      - `street_type_change`
      - `street_directional_change`
      - `sub_premise_type_change`
      - `sub_premise_number_change`
      - `double_dependent_locality_change`
      - `subadministrative_area_change`
      - `subnational_area_change`
      - `po_box_change`
      - `premise_type_change`
      - `house_number_change`
      - `organization_change`
      - `extraneous_information`
      - `usps_door_inaccessible`
      - `administrative_area_partial`
      - `city_partial`
      - `street_partial`
      - `building_partial`
      - `subpremise_partial`
      - `administrative_area_full`
      - `city_full`
      - `thoroughfare_full`
      - `premises_full`
      - `subpremise_full`
      - `geocoded_street`
      - `geocoded_neighborhood`
      - `geocoded_community`
      - `geocoded_state`
      - `geocoded_rooftop`
      - `geocoded_interpolated_rooftop`
      - `invalid_postal_code`
      - `postal_code_not_found`
      - `empty_request`
      - `service_error`
      - `street_detail_missing`
      - `Invalid City/State/Zip`
      - `Default Match`
      - `Unknown Street`
      - `Address Not Found`
      - `Non-Deliverable ZIP4`
      - `Multiple Responses`
      - `Invalid Dual Address`
      - `Invalid State`
      - `Invalid City`
      - `Ambiguous Address`
paths:
  /batches/{BatchId}/remove_shipments:
    post:
      tags:
        - Batches
      summary: Remove shipments from a batch
      description: Removes shipments from an existing batch shipment.
      operationId: RemoveShipmentsFromBatch
      parameters:
        - description: Object ID of the batch
          in: path
          name: BatchId
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/ShippoApiVersionHeader'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              items:
                type: string
              type: array
        description: Array of shipments object ids to remove from the batch
      responses:
        '200':
          $ref: '#/components/responses/batchResponse'
        '400':
          $ref: '#/components/responses/badRequestResponse'
      x-codeSamples:
        - label: cURL
          lang: cURL
          source: >-
            curl -X POST https://api.goshippo.com/batches/<BATCH OBJECT
            ID>/remove_shipments \

            -H "Authorization: ShippoToken <API_TOKEN>" \

            -H "Content-Type: application/json"  \

            -d '[
                  "aa7dea463a5a48b0b8fb21f90e72d779",
                  "f11b46440c144ce3b97fb5ddf02b8c71",
                  "5400f9078f764b1bbb121bcd08de127f",
                  "2ab2b452392545908d2cef8861a39c35"
                ]'
        - lang: python
          label: Python
          source: |-
            import shippo

            s = shippo.Shippo(
                api_key_header='ShippoToken <API_TOKEN>',
                shippo_api_version='2018-02-08',
            )


            res = s.batches.remove_shipments(request_body=[
                '<value>',
                '<value>',
                '<value>',
            ], batch_id='<id>')

            if res is not None:
                # handle response
                pass
        - lang: typescript
          label: Typescript
          source: |-
            import { Shippo } from "shippo";

            const shippo = new Shippo({
              apiKeyHeader: "ShippoToken <API_TOKEN>",
              shippoApiVersion: "2018-02-08",
            });

            async function run() {
              const result = await shippo.batches.removeShipments([
                "<value>",
                "<value>",
                "<value>",
              ], "<id>");

              // Handle the result
              console.log(result);
            }

            run();
        - lang: csharp
          label: C#
          source: |-
            using Shippo;
            using Shippo.Models.Components;
            using System.Collections.Generic;

            var sdk = new ShippoSDK(
                apiKeyHeader: "ShippoToken <API_TOKEN>",
                shippoApiVersion: "2018-02-08"
            );

            var res = await sdk.Batches.RemoveShipmentsAsync(
                batchId: "<id>",
                requestBody: new List<string>() {
                    "<value>",
                },
                shippoApiVersion: "2018-02-08"
            );

            // handle response
        - lang: php
          label: PHP
          source: |-
            declare(strict_types=1);

            require 'vendor/autoload.php';

            use Shippo\API;

            $sdk = API\Shippo::builder()
                ->setSecurity(
                    'ShippoToken <API_TOKEN>'
                )
                ->setShippoApiVersion('2018-02-08')
                ->build();



            $response = $sdk->batches->removeShipments(
                batchId: '<id>',
                requestBody: [
                    '<value>',
                ],
                shippoApiVersion: '2018-02-08'

            );

            if ($response->batch !== null) {
                // handle response
            }
        - lang: java
          label: Java
          source: >-
            package hello.world;


            import com.goshippo.shippo_sdk.Shippo;

            import
            com.goshippo.shippo_sdk.models.operations.RemoveShipmentsFromBatchResponse;

            import java.lang.Exception;

            import java.util.List;


            public class Application {

                public static void main(String[] args) throws Exception {

                    Shippo sdk = Shippo.builder()
                            .apiKeyHeader("ShippoToken <API_TOKEN>")
                            .shippoApiVersion("2018-02-08")
                        .build();

                    RemoveShipmentsFromBatchResponse res = sdk.batches().removeShipments()
                            .batchId("<id>")
                            .shippoApiVersion("2018-02-08")
                            .requestBody(List.of(
                                "<value>",
                                "<value>",
                                "<value>"))
                            .call();

                    if (res.batch().isPresent()) {
                        // handle response
                    }
                }
            }
components:
  parameters:
    ShippoApiVersionHeader:
      description: >-
        Optional string used to pick a non-default API version to use. See our
        <a href="https://docs.goshippo.com/docs/api_concepts/apiversioning/">API
        version</a> guide.
      in: header
      name: SHIPPO-API-VERSION
      schema:
        type: string
        example: '2018-02-08'
        default: '2018-02-08'
        x-default: '2018-02-08'
      x-speakeasy-globals-hidden: true
  responses:
    batchResponse:
      description: Batch
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Batch'
    badRequestResponse:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/BadRequest'
  schemas:
    Batch:
      x-tags:
        - Batches
      allOf:
        - $ref: '#/components/schemas/BatchBase'
        - properties:
            batch_shipments:
              $ref: '#/components/schemas/BatchShipmentPaginatedList'
            label_url:
              description: >-
                An array of URLs each pointing to a merged file of 100 labels
                each
              items:
                type: string
              type: array
            object_created:
              description: Date and time of Batch creation
              example: '2016-01-04T00:15:44.394Z'
              type: string
            object_id:
              description: Unique identifier of the given Batch object
              example: 5ef63c54f5bf45d3b1f8fb37dcb1c5f4
              type: string
            object_owner:
              description: Username of the user who created the Batch object.
              example: shippo@shippo.com
              type: string
            object_results:
              description: >-
                An object containing the following
                counts:<br>`creation_succeeded`<br>`creation_failed`<br>`purchase_succeeded`<br>`purchase_failed`
              properties:
                creation_failed:
                  example: 3
                  format: int64
                  type: integer
                creation_succeeded:
                  example: 5
                  format: int64
                  type: integer
                purchase_failed:
                  example: 0
                  format: int64
                  type: integer
                purchase_succeeded:
                  example: 0
                  format: int64
                  type: integer
              required:
                - purchase_failed
                - purchase_succeeded
                - creation_failed
                - creation_succeeded
              type: object
            object_updated:
              description: Date and time of last update to the Batch
              example: '2016-01-04T00:48:13.841Z'
              type: string
            status:
              description: >-
                Batches that are `VALIDATING` are being created and
                validated<br>

                `VALID` batches can be purchased<br>

                `INVALID` batches cannot be purchased, `INVALID` BatchShipments
                must be removed<br>

                Batches that are in the `PURCHASING` state are being
                purchased<br>

                `PURCHASED` batches are finished purchasing.
              enum:
                - VALIDATING
                - VALID
                - INVALID
                - PURCHASING
                - PURCHASED
              example: VALID
              type: string
            test:
              example: false
              type: boolean
          required:
            - object_id
            - object_owner
            - status
            - object_created
            - object_updated
            - batch_shipments
            - object_results
            - label_url
    BadRequest:
      additionalProperties: true
      type: object
    BatchBase:
      properties:
        default_carrier_account:
          description: >-
            ID of the Carrier Account object to use as the default for all
            shipments in this Batch. 

            The carrier account can be changed on a per-shipment basis by
            changing the carrier_account in the 

            corresponding BatchShipment object.
          example: 078870331023437cb917f5187429b093
          type: string
        default_servicelevel_token:
          description: >-
            Token of the service level to use as the default for all shipments
            in this Batch. 

            The servicelevel can be changed on a per-shipment basis by changing
            the servicelevel_token in the 

            corresponding BatchShipment object. <a
            href="/shippoapi/public-api/service-levels">Servicelevel tokens can
            be found here.</a>
          example: usps_priority
          type: string
        label_filetype:
          $ref: '#/components/schemas/LabelFileTypeEnum'
        metadata:
          description: >-
            A string of up to 100 characters that can be filled with any
            additional information you want to attach to the object.
          example: 'BATCH #1'
          maxLength: 100
          type: string
      required:
        - default_carrier_account
        - default_servicelevel_token
      type: object
    BatchShipmentPaginatedList:
      allOf:
        - $ref: '#/components/schemas/PaginatedList'
        - description: >-
            Array of <a
            href="/shippoapi/public-api/batches/batchshipment">BatchShipment</a>
            objects. 

            The response keeps the same order as in the request array.
          properties:
            results:
              items:
                $ref: '#/components/schemas/BatchShipment'
              type: array
    LabelFileTypeEnum:
      description: >-
        Print format of the <a
        href="https://docs.goshippo.com/docs/shipments/shippinglabelsizes/">label</a>.
        If empty, will use the default format set from 

        <a href="https://apps.goshippo.com/settings/labels">the Shippo
        dashboard.</a>
      enum:
        - PNG
        - PNG_2.3x7.5
        - PDF
        - PDF_2.3x7.5
        - PDF_4x6
        - PDF_4x8
        - PDF_A4
        - PDF_A5
        - PDF_A6
        - ZPLII
      example: PDF_4x6
      type: string
    PaginatedList:
      properties:
        next:
          example: baseurl?page=3&results=10
          type: string
        previous:
          example: baseurl?page=1&results=10
          type: string
      type: object
    BatchShipment:
      title: Batch Shipment
      x-tags:
        - Batches
      description: >-
        The batch shipment object is a wrapper around a shipment object, which
        include shipment-specific information

        for batch processing.


        Note: batch shipments can only be created on the batch endpoint, either
        when creating a batch object or by through

        the `/batches/{BATCH_OBJECT_ID}/add_shipments` endpoint
      allOf:
        - $ref: '#/components/schemas/BatchShipmentBase'
        - properties:
            messages:
              description: List of Shipment and Transaction error messages.
              type: array
              items: {}
            object_id:
              description: >-
                Object ID of this batch shipment. Can be used in the
                remove_shipments endpoint.
              example: e11c95a6788d4ddcaa22f03175838740
              type: string
            shipment:
              description: >-
                Object ID of the shipment object created for this batch
                shipment.
              example: adcfdddf8ec64b84ad22772bce3ea37a
              type: string
            status:
              description: >-
                `INVALID` batch shipments cannot be purchased and will have to
                be removed, fixed, and added to the batch again.<br>

                `VALID` batch shipments can be purchased. <br>

                Batch shipments with the status `TRANSACTION_FAILED` were not
                able to be purchased and the error will be displayed on the
                message field<br> 

                `INCOMPLETE` batch shipments have an issue with the Address and
                will need to be removed, fixed, and added to the batch again.
              enum:
                - INVALID
                - VALID
                - INCOMPLETE
                - TRANSACTION_FAILED
              example: INVALID
              type: string
            transaction:
              description: >-
                Object ID of the transaction object created for this batch
                shipment.
              example: 4c33736a67e2450da88b38c42deef6b7
              type: string
          required:
            - shipment
            - object_id
            - status
    BatchShipmentBase:
      properties:
        carrier_account:
          description: >-
            Object ID of the carrier account to be used for this shipment (will
            override batch default)
          example: a4391cd4ab974f478f55dc08b5c8e3b3
          type: string
        metadata:
          description: >-
            A string of up to 100 characters that can be filled with any
            additional information you want 

            to attach to the object.
          example: 'SHIPMENT #1'
          maxLength: 100
          type: string
        servicelevel_token:
          description: >-
            A token that sets the shipping method for the batch, overriding the
            batch default. 

            Servicelevel tokens can be found <a
            href="/shippoapi/public-api/service-levels">in this list</a> 

            or <a
            href="/shippoapi/public-api/carrier-accounts/listcarrieraccounts">at
            this endpoint</a>.
          example: fedex_ground
          type: string
      type: object
  securitySchemes:
    APIKeyHeader:
      type: apiKey
      in: header
      name: Authorization
      x-token-prefix: ShippoToken
      x-token-format: ShippoToken {token}
      x-default: 'ShippoToken '
      description: |
        API key authentication using the ShippoToken scheme.
        Format: Authorization: ShippoToken <API_TOKEN>
        Example: Authorization: ShippoToken shippo_live_abc123

````