---
title: "Create a rate"
url: "https://docs.unified.to/shipping/rate/Create_a_rate"
description: "Create a rate with Unified's Rate API (POST /shipping/{connection_id}/rate). Filter by fields and raw. Supported by 13 Rate integrations."
---
# Create a rate

 POST/shipping/{connection\_id}/rate

## Parameters

**fields**string array 

shipment\_id

currency

from\_address

to\_address

packages

ship\_by\_at

carrier\_id

id

rates

raw

Fields to return

**raw**string 

Raw parameters to include in the 3rd-party request. Encoded as a URL component. eg. raw parameters: foo=bar&zoo=bar -> raw=foo%3Dbar%26zoo%3Dbar

**connection\_id**string  required 

ID of the connection

## Payload

**shipment\_id**string 

Reference to the shipping object (if rate is for existing shipment)

**currency**string 

**from\_address**object 

Origin address

**to\_address**object 

Destination address

**packages** array 

Multiple packages (alternative to package)

**ship\_by\_at**date-time 

Latest date to ship (from order) (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)

**carrier\_id**string 

Reference to the carrier

**id**string 

Unique identifier for this rate object

**rates** array 

**raw** 

## Returns

[ShippingRate](https://docs.unified.to/shipping/rate/model.md)

| Response field                           | Type                                                                                                          | Required | Description                                                                       |
| ---------------------------------------- | ------------------------------------------------------------------------------------------------------------- | -------- | --------------------------------------------------------------------------------- |
| shipment\_id                             | string                                                                                                        | No       | Reference to the shipping object (if rate is for existing shipment)               |
| currency                                 | string                                                                                                        | No       |                                                                                   |
| from\_address                            | object                                                                                                        | No       | Origin address                                                                    |
| from\_address.address1                   | string                                                                                                        | No       |                                                                                   |
| from\_address.address2                   | string                                                                                                        | No       |                                                                                   |
| from\_address.city                       | string                                                                                                        | No       |                                                                                   |
| from\_address.region                     | string                                                                                                        | No       |                                                                                   |
| from\_address.region\_code               | string                                                                                                        | No       |                                                                                   |
| from\_address.postal\_code               | string                                                                                                        | No       |                                                                                   |
| from\_address.country                    | string                                                                                                        | No       |                                                                                   |
| from\_address.country\_code              | string                                                                                                        | No       | ISO 2-digit country code                                                          |
| from\_address.name                       | string                                                                                                        | No       | Recipientsender name                                                              |
| from\_address.company\_name              | string                                                                                                        | No       | Company name (for commercial addresses)                                           |
| from\_address.telephone                  | string                                                                                                        | No       | Phone number (required by FedEx, UPS, DHL)                                        |
| from\_address.email                      | string                                                                                                        | No       | Email address (for delivery notifications)                                        |
| from\_address.is\_residential            | boolean                                                                                                       | No       | Alias for address\_type === 'RESIDENTIAL'                                         |
| from\_address.is\_validated              | boolean                                                                                                       | No       | Whether address has been validated                                                |
| from\_address.delivery\_instructions     | string                                                                                                        | No       | Special delivery notes                                                            |
| to\_address                              | object                                                                                                        | No       | Destination address                                                               |
| to\_address.address1                     | string                                                                                                        | No       |                                                                                   |
| to\_address.address2                     | string                                                                                                        | No       |                                                                                   |
| to\_address.city                         | string                                                                                                        | No       |                                                                                   |
| to\_address.region                       | string                                                                                                        | No       |                                                                                   |
| to\_address.region\_code                 | string                                                                                                        | No       |                                                                                   |
| to\_address.postal\_code                 | string                                                                                                        | No       |                                                                                   |
| to\_address.country                      | string                                                                                                        | No       |                                                                                   |
| to\_address.country\_code                | string                                                                                                        | No       | ISO 2-digit country code                                                          |
| to\_address.name                         | string                                                                                                        | No       | Recipientsender name                                                              |
| to\_address.company\_name                | string                                                                                                        | No       | Company name (for commercial addresses)                                           |
| to\_address.telephone                    | string                                                                                                        | No       | Phone number (required by FedEx, UPS, DHL)                                        |
| to\_address.email                        | string                                                                                                        | No       | Email address (for delivery notifications)                                        |
| to\_address.is\_residential              | boolean                                                                                                       | No       | Alias for address\_type === 'RESIDENTIAL'                                         |
| to\_address.is\_validated                | boolean                                                                                                       | No       | Whether address has been validated                                                |
| to\_address.delivery\_instructions       | string                                                                                                        | No       | Special delivery notes                                                            |
| packages                                 | [ShippingPackage](https://docs.unified.to/shipping/rate/Create%5Fa%5Frate.md#ShippingPackage)\[\]             | No       | Multiple packages (alternative to package)                                        |
| packages\[\].weight                      | number                                                                                                        | No       | Weight of the package                                                             |
| packages\[\].weight\_unit                | enum                                                                                                          | No       | Unit for weight (g, kg, oz, lb) Values: g, kg, oz, lb                             |
| packages\[\].length                      | number                                                                                                        | No       | Length of the package                                                             |
| packages\[\].width                       | number                                                                                                        | No       | Width of the package                                                              |
| packages\[\].height                      | number                                                                                                        | No       | Height of the package                                                             |
| packages\[\].size\_unit                  | enum                                                                                                          | No       | Unit for dimensions (cm, inch) Values: cm, inch                                   |
| packages\[\].description                 | string                                                                                                        | No       | Description of the package contents                                               |
| packages\[\].value                       | number                                                                                                        | No       | Declared value of the package                                                     |
| packages\[\].currency                    | string                                                                                                        | No       | ISO 4217 currency code                                                            |
| packages\[\].tracking\_number            | string                                                                                                        | No       | Package-level tracking (for multi-package shipments)                              |
| packages\[\].insured\_amount             | number                                                                                                        | No       | Insured value for this package                                                    |
| ship\_by\_at                             | string (date-time)                                                                                            | No       | Latest date to ship (from order) (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)         |
| carrier\_id                              | string                                                                                                        | No       | Reference to the carrier                                                          |
| id                                       | string                                                                                                        | No       | Unique identifier for this rate object                                            |
| rates                                    | [ShippingRateRate](https://docs.unified.to/shipping/rate/Create%5Fa%5Frate.md#ShippingRateRate)\[\]           | No       |                                                                                   |
| rates\[\].title                          | string                                                                                                        | Yes      |                                                                                   |
| rates\[\].description                    | string                                                                                                        | No       |                                                                                   |
| rates\[\].amount                         | number                                                                                                        | No       |                                                                                   |
| rates\[\].currency                       | string                                                                                                        | No       |                                                                                   |
| rates\[\].base\_amount                   | number                                                                                                        | No       | Base shipping rate                                                                |
| rates\[\].tax\_amount                    | number                                                                                                        | No       |                                                                                   |
| rates\[\].discount\_amount               | number                                                                                                        | No       | Applied discount                                                                  |
| rates\[\].surcharges                     | [ShippingRateSurcharge](https://docs.unified.to/shipping/rate/Create%5Fa%5Frate.md#ShippingRateSurcharge)\[\] | No       | Additional charges                                                                |
| rates\[\].surcharges\[\].code            | string                                                                                                        | No       | Surcharge type (e.g., "RESIDENTIAL", "FUEL", "SIGNATURE")                         |
| rates\[\].surcharges\[\].name            | string                                                                                                        | No       | Human-readable name                                                               |
| rates\[\].surcharges\[\].amount          | number                                                                                                        | No       | Surcharge amount                                                                  |
| rates\[\].surcharges\[\].description     | string                                                                                                        | No       | Description of surcharge                                                          |
| rates\[\].rate\_source                   | string                                                                                                        | No       | Source of rate (e.g., "carrier", "negotiated", "account")                         |
| rates\[\].is\_negotiated\_rate           | boolean                                                                                                       | No       | Whether this is a negotiated rate                                                 |
| rates\[\].estimated\_days                | number                                                                                                        | No       | Estimated delivery time in days                                                   |
| rates\[\].delivery\_days                 | number                                                                                                        | No       | Delivery days (integer)                                                           |
| rates\[\].estimated\_delivery\_end\_at   | string (date-time)                                                                                            | No       | Specific delivery date (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format)                   |
| rates\[\].estimated\_delivery\_start\_at | string (date-time)                                                                                            | No       | Time window (e.g., "10:00 AM - 2:00 PM") (ISO-8601 / YYYY-MM-DDTHH:MM:SSZ format) |
| rates\[\].delivery\_terms                | string                                                                                                        | No       | Delivery duration terms (e.g., "3-5 business days")                               |
| rates\[\].transit\_hours                 | number                                                                                                        | No       | Transit time in hours                                                             |
| rates\[\].is\_guaranteed                 | boolean                                                                                                       | No       | Whether delivery is guaranteed                                                    |
| rates\[\].package\_type                  | string                                                                                                        | No       | Package type (e.g., "package", "envelope", "flat")                                |
| rates\[\].is\_trackable                  | boolean                                                                                                       | No       | Whether shipment is trackable                                                     |
| rates\[\].is\_active                     | boolean                                                                                                       | No       | Whether rate is currently available                                               |

## Errors

 Errors return the HTTP status code and a JSON body with `statusCode`, `error` (the short label) and `message` (a human-readable detail). 

```json
{
  "statusCode": 429,
  "error": "Too Many Requests",
  "message": "Too many requests to unified.to API; max requests per minute: N"
}
```

| Status | Error                 | Meaning                                           |
| ------ | --------------------- | ------------------------------------------------- |
| 400    | Bad Request           | The request was malformed or failed validation.   |
| 401    | Unauthorized          | The connection is likely broken; re-authorize it. |
| 403    | Forbidden             | The connection is missing permissions or scopes.  |
| 404    | Not Found             | The requested resource does not exist.            |
| 429    | Too Many Requests     | Rate limit exceeded (see the two sources below).  |
| 500    | Internal Server Error | An unexpected error occurred.                     |
| 501    | Not Implemented       | Not supported by this integration.                |

 Errors from the underlying integration pass through: the integration's status comes back as ours (429, 401, 403, 404 or 5xx), usually with its message. When the integration's error body is unclear, Unified extracts what it can and returns a clearer message. 

### 429 Too Many Requests

A 429 has two possible sources:

* The integration's own rate limit, passed through.
* Unified's workspace limit: a rolling 60 seconds, set by plan, with the message `Too many requests to unified.to API; max requests per minute: N`.

## Code Samples

### Node.js SDK

```javascript
import { UnifiedTo } from '@unified-api/typescript-sdk';

const sdk = new UnifiedTo({
    security: {
        jwt: '<YOUR_API_KEY_HERE>',
    },
});

const connectionId = '5de520f96e439b002043d8dc';

const results = await sdk.shipping.createShippingRate({ connectionId, shippingRate: { }, 
    fields: '',
    raw: '',
 });
```

### Node.js (axios)

```javascript
const options = {
  method: 'POST',
  url: 'https://api.unified.to/shipping/5de520f96e439b002043d8dc/rate',
  headers: {
    authorization: 'bearer .....'
  },
  data: undefined,
  params: {
    fields: '',
    raw: '',
  }
};

const results = await axios.request(options);
```

### Java

```java
AsyncHttpClient client = new DefaultAsyncHttpClient();

client.prepare("POST", "https://api.unified.to/shipping/5de520f96e439b002043d8dc/rate?fields=&raw=")
  .setHeader("accept", "application/json")
  .setHeader("authorization", ".....")
  .execute()
  .toCompletableFuture()
  .thenAccept(System.out::println)
  .join();

client.close();
```

### Go

```go
import (
	"fmt"
	"net/http"
	"io/ioutil"
)

url := `https://api.unified.to/shipping/5de520f96e439b002043d8dc/rate?fields=&raw=

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

req.Header.Add("accept", "application/json")
req.Header.Add("authorization", ".....")

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

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

### Python

```python
import requests

url = "https://api.unified.to/shipping/5de520f96e439b002043d8dc/rate?fields=&raw="

headers = {
    "accept": "application/json",
    "authorization": "....."
}

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

### PHP

```php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.unified.to/shipping/5de520f96e439b002043d8dc/rate?fields=&raw=",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_HTTPHEADER => [
    "accept: application/json",
    "authorization: ....."
  ],
]);
```

### Ruby

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

url = URI("https://api.unified.to/shipping/5de520f96e439b002043d8dc/rate?fields=&raw=")

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

request = Net::HTTP::Post.new(url)
request["accept"] = 'application/json'
request["authorization"] = '....'

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

### cURL

```bash
curl --request POST \
  --url 'https://api.unified.to/shipping/5de520f96e439b002043d8dc/rate?fields=&raw=' \
  --header 'accept: application/json' \
  --header 'authorization: .....'
```
