> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developer.shipbob.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developer.shipbob.com/_mcp/server.

# Bulk Upload Shipment Attachments


POST https://api.shipbob.com/2026-07/shipment:bulkUploadAttachments

Uploads a single file to one or more shipments (1–250) in a single request. The endpoint enforces the full server-side attachment-type validation matrix — attachment type eligibility, label state, shipment state, order type, retailer program, and max-one rules — and records the uploader.

Request must be sent as **multipart/form-data** with the following fields:

| Field | Type | Required | Description |
|-------|------|----------|-------------|
| file | file | Yes | The binary file content to upload. Supported types: PDF, JPG/JPEG, PNG (max 3 MB). Magic-byte validation is applied in addition to extension checks. |
| shipment_ids | integer (repeated field) | Yes | 1–250 shipment IDs to attach the file to. Repeat the field once per ID (e.g. `shipment_ids=123456&shipment_ids=789012`) — not a JSON array. |
| attachment_type_id | integer | Yes | The attachment type (0–16). |

**Per-shipment results:** every shipment is evaluated independently. One shipment failing never fails the whole request. HTTP 400 is returned only when the request itself is invalid (missing/oversized/wrong-extension file, invalid `attachment_type_id`, empty or >250 ids, missing `Idempotency-Key` header).

**Idempotency:** supply a unique `Idempotency-Key` header per logical upload attempt. Duplicate keys return HTTP 409.


Reference: https://developer.shipbob.com/api/orders/bulk-upload-shipment-attachments

## Authentication

- `Authorization` header (bearer token, required) — Authentication using Personal Access Token (PAT) token
- `Authorization` header (bearer token, required) — OAuth2 authentication using JWT tokens

## Servers

- `https://api.shipbob.com` (https://api.shipbob.com, default)
- `https://sandbox-api.shipbob.com` (https://sandbox-api.shipbob.com)

## Request

### Headers

- `Idempotency-Key` (string, required) — Unique key for idempotent replay protection. Use a UUID per logical upload attempt.

## Response

### 200

OK

- `summary` (object, required) — Summary of the bulk operation results
  - `failed` (integer, optional) — Number of shipments that failed to update
  - `successful` (integer, optional) — Number of shipments that were updated successfully
  - `total` (integer, optional) — Total number of shipments included in the bulk operation
- `results` (list of object, optional, nullable) — Per-shipment results of the bulk operation
  - `error` (object, optional, nullable) — Error details if the operation was not successful
    - `code` (enum, optional) — Error code identifying the type of error
      - Allowed values: `INVALID_PARAMETER`, `VALIDATION_ERROR`, `DATABASE_UPDATE_ERROR`, `REPROCESSING_ERROR`, `DEALLOCATE_ERROR`, `NOT_FOUND`, `CONFLICT`
    - `message` (string, optional, nullable) — Human-readable description of the error
  - `id` (long, optional) — Unique identifier of the shipment
  - `is_success` (boolean, optional) — Indicates whether the operation was successful for this shipment

## Examples

**Response**

```json
{
  "summary": {
    "failed": 0,
    "successful": 2,
    "total": 2
  },
  "results": [
    {
      "id": 123456,
      "is_success": true
    },
    {
      "id": 789012,
      "is_success": true
    }
  ]
}
```

**SDK Code**

```python default
import requests

url = "https://api.shipbob.com/2026-07/shipment:bulkUploadAttachments"

headers = {
    "Idempotency-Key": "Idempotency-Key",
    "Authorization": "Bearer <token>"
}

response = requests.post(url, headers=headers)

print(response.json())
```

```javascript default
const url = 'https://api.shipbob.com/2026-07/shipment:bulkUploadAttachments';
const options = {
  method: 'POST',
  headers: {'Idempotency-Key': 'Idempotency-Key', Authorization: 'Bearer <token>'}
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go default
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://api.shipbob.com/2026-07/shipment:bulkUploadAttachments"

	req, _ := http.NewRequest("POST", url, nil)

	req.Header.Add("Idempotency-Key", "Idempotency-Key")
	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby default
require 'uri'
require 'net/http'

url = URI("https://api.shipbob.com/2026-07/shipment:bulkUploadAttachments")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = 'Idempotency-Key'
request["Authorization"] = 'Bearer <token>'

response = http.request(request)
puts response.read_body
```

```java default
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.shipbob.com/2026-07/shipment:bulkUploadAttachments")
  .header("Idempotency-Key", "Idempotency-Key")
  .header("Authorization", "Bearer <token>")
  .asString();
```

```php default
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.shipbob.com/2026-07/shipment:bulkUploadAttachments', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Idempotency-Key' => 'Idempotency-Key',
  ],
]);

echo $response->getBody();
```

```csharp default
using RestSharp;

var client = new RestClient("https://api.shipbob.com/2026-07/shipment:bulkUploadAttachments");
var request = new RestRequest(Method.POST);
request.AddHeader("Idempotency-Key", "Idempotency-Key");
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift default
import Foundation

let headers = [
  "Idempotency-Key": "Idempotency-Key",
  "Authorization": "Bearer <token>"
]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.shipbob.com/2026-07/shipment:bulkUploadAttachments")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```