> This page is for version Staging.
> For other versions, use one of these documentation indexes:
> - Prod (default): https://docs.chrt.com/prod/llms.txt
> - Staging: https://docs.chrt.com/staging/llms.txt
> - Dev: https://docs.chrt.com/dev/llms.txt

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

# Sync booking record from WebCargo

POST https://api.staging.chrt.com/integrations/webcargo_bookings/sync/v1/{task_group_id}

Fetches the latest booking record from WebCargo for a task group and upserts it in the database. Creates the record on first call, updates on subsequent calls. | () -> (WebcargoBookingRecord1)

Reference: https://docs.chrt.com/api-reference/api-reference/integrations/webcargo-bookings/sync-v-1

## Authentication

- `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer <token>`, where token is your auth token.

## Request

### Path parameters

- `task_group_id` (string, required)

## Response

### 200

Successful Response

- `_id` (string, required)
- `awb_number` (string, required)
- `booking_rate` (WebcargoBookingRate, required)
- `business_info` (WebcargoBusinessInfo, required)
- `document_identifiers` (list of WebcargoDocumentIdentifier, required)
- `message_header` (WebcargoMessageHeader, required)
- `org_id` (string, required) — Must be a string starting with `org_`
- `schema_version` (integer, required)
- `synced_at` (datetime, required)
- `task_group_id` (string, required)
- `response_status` (WebcargoResponseStatus, optional)
- `shipment` (WebcargoShipment, optional)

## Errors

### 422 Webcargo Bookings Sync V1request Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### WebcargoBookingRate

- `commodity_classification` (list of WebcargoCommodityClass, optional)
- `connection` (WebcargoConnection, optional)
- `destination_location` (WebcargoLocation, optional)
- `hash` (string, optional)
- `latest_acceptance_date` (string, optional)
- `load` (WebcargoLoad, optional)
- `origin_location` (WebcargoLocation, optional)
- `price_indicator` (WebcargoPriceIndicator, optional)
- `product` (WebcargoProduct, optional)
- `reference_id` (string, optional)
- `shipment_priority_code` (string, optional)
- `special_handling_codes` (list of string, optional)
- `time_of_availability` (string, optional)
- `transport_mode` (string, optional)

### WebcargoBusinessInfo

- `method_reason` (string, optional)
- `parties` (list of WebcargoParty, optional)
- `service_method` (string, optional)

### WebcargoDocumentIdentifier

- `document_id` (string, optional)
- `document_type` (string, optional)
- `external_booking_reference_number` (string, optional)

### WebcargoMessageHeader

- `message_id` (string, optional)
- `request_id` (string, optional)

### WebcargoResponseStatus

- `statuses` (list of WebcargoResponseStatusEntry, optional)

### WebcargoShipment

- `latest_acceptance_date` (string, optional)
- `time_of_availability` (string, optional)
- `transport_mode` (string, optional)

### ValidationError

- `loc` (list of LocationItem, required)
- `msg` (string, required)
- `type` (string, required)
- `ctx` (map from string to any, optional)
- `input` (any, optional)

### WebcargoCommodityClass

- `classification_code` (string, optional)
- `commodity_category_code` (string, optional)
- `name` (string, optional)

### WebcargoConnection

- `general_charges` (list of WebcargoFee, optional)
- `segments` (list of WebcargoSegment, optional)

### WebcargoLocation

- `country_id` (string, optional)
- `country_name` (string, optional)
- `location_code` (string, optional)
- `location_name` (string, optional)
- `location_type_code` (string, optional)
- `postal_code` (string, optional)

### WebcargoLoad

- `net_volume_measure` (WebcargoValueWithUnit, optional) — XML element with text content and a unitCode attribute. Parses e.g. `<Width unitCode="CMT">10.0</Width>` into `value="10.0", unit_code="CMT"`.
- `net_weight` (WebcargoValueWithUnit, optional) — XML element with text content and a unitCode attribute. Parses e.g. `<Width unitCode="CMT">10.0</Width>` into `value="10.0", unit_code="CMT"`.
- `packages` (list of WebcargoPackage, optional)
- `total_chargeable_weight` (WebcargoValueWithUnit, optional) — XML element with text content and a unitCode attribute. Parses e.g. `<Width unitCode="CMT">10.0</Width>` into `value="10.0", unit_code="CMT"`.
- `total_quantity` (string, optional)

### WebcargoPriceIndicator

- `rate_currency` (string, optional)
- `rate_type` (string, optional)
- `total_charge` (string, optional)
- `unit_of_measure` (string, optional)
- `unit_rate` (string, optional)
- `valid_from` (string, optional)
- `valid_to` (string, optional)

### WebcargoProduct

- `product_code` (string, optional)
- `product_description` (string, optional)

### WebcargoParty

- `account_id_list` (list of WebcargoAccountID, optional)
- `contact` (WebcargoContact, optional)
- `id` (string, optional)
- `name` (string, optional)
- `party_type_code` (string, optional)
- `postal_address` (WebcargoPostalAddress, optional)

### WebcargoResponseStatusEntry

- `code` (string, optional)
- `reason` (string, optional)

### LocationItem

- string
- integer

### WebcargoFee

- `currency` (string, optional)
- `fee_category` (string, optional)
- `fee_code` (string, optional)
- `fee_comment` (string, optional)
- `fee_location_type` (string, optional)
- `fee_name` (string, optional)
- `fee_type` (string, optional)
- `inclusive` (string, optional)
- `quantity` (string, optional)
- `rate` (string, optional)
- `unit_rate` (string, optional)

### WebcargoSegment

- `destination` (WebcargoLocation, optional)
- `itinerary_number` (string, optional)
- `latest_acceptance_date` (string, optional)
- `legs` (list of WebcargoLeg, optional)
- `marketing_carrier` (WebcargoCarrier, optional)
- `operating_carrier` (WebcargoCarrier, optional)
- `origin` (WebcargoLocation, optional)
- `scheduled_time_of_arrival` (string, optional)
- `scheduled_time_of_departure` (string, optional)
- `segment_id` (string, optional)
- `status` (WebcargoBookStatus, optional)
- `transport_mode` (string, optional)
- `vehicle_name` (string, optional)
- `vehicle_number` (string, optional)
- `vehicle_type` (string, optional)

### WebcargoValueWithUnit

XML element with text content and a unitCode attribute. Parses e.g. `<Width unitCode="CMT">10.0</Width>` into `value="10.0", unit_code="CMT"`.

- `unit_code` (string, optional)
- `value` (string, optional)

### WebcargoPackage

- `dimensions` (list of WebcargoDimension, optional)
- `packaging_type` (string, optional)
- `quantity` (string, optional)
- `stackable` (string, optional)
- `turnable` (string, optional)
- `weight` (WebcargoValueWithUnit, optional) — XML element with text content and a unitCode attribute. Parses e.g. `<Width unitCode="CMT">10.0</Width>` into `value="10.0", unit_code="CMT"`.

### WebcargoAccountID

- `id_source` (string, optional)
- `value` (string, optional)

### WebcargoContact

- `electronic_mail` (string, optional)
- `id` (string, optional)
- `name` (string, optional)
- `telephone` (string, optional)

### WebcargoPostalAddress

- `city_id` (string, optional)
- `city_name` (string, optional)
- `country_id` (string, optional)
- `country_name` (string, optional)
- `location_name` (string, optional)
- `location_type_code` (string, optional)
- `postal_code` (string, optional)
- `state_or_province` (string, optional)
- `street_name` (string, optional)

### WebcargoLeg

- `destination` (WebcargoLocation, optional)
- `origin` (WebcargoLocation, optional)
- `scheduled_time_of_arrival` (string, optional)
- `scheduled_time_of_departure` (string, optional)

### WebcargoCarrier

- `carrier_code` (string, optional)

### WebcargoBookStatus

- `code` (string, optional)
- `reason` (string, optional)

### WebcargoDimension

- `height` (WebcargoValueWithUnit, optional) — XML element with text content and a unitCode attribute. Parses e.g. `<Width unitCode="CMT">10.0</Width>` into `value="10.0", unit_code="CMT"`.
- `length` (WebcargoValueWithUnit, optional) — XML element with text content and a unitCode attribute. Parses e.g. `<Width unitCode="CMT">10.0</Width>` into `value="10.0", unit_code="CMT"`.
- `width` (WebcargoValueWithUnit, optional) — XML element with text content and a unitCode attribute. Parses e.g. `<Width unitCode="CMT">10.0</Width>` into `value="10.0", unit_code="CMT"`.

## Examples

**Response**

```json
{
  "_id": "_id",
  "awb_number": "awb_number",
  "booking_rate": {
    "commodity_classification": [
      {}
    ],
    "connection": {
      "general_charges": [
        {}
      ],
      "segments": [
        {}
      ]
    },
    "destination_location": {
      "country_id": "country_id",
      "country_name": "country_name",
      "location_code": "location_code",
      "location_name": "location_name",
      "location_type_code": "location_type_code",
      "postal_code": "postal_code"
    },
    "hash": "hash",
    "latest_acceptance_date": "latest_acceptance_date",
    "load": {
      "packages": [
        {}
      ],
      "total_quantity": "total_quantity"
    },
    "origin_location": {
      "country_id": "country_id",
      "country_name": "country_name",
      "location_code": "location_code",
      "location_name": "location_name",
      "location_type_code": "location_type_code",
      "postal_code": "postal_code"
    },
    "price_indicator": {
      "rate_currency": "rate_currency",
      "rate_type": "rate_type",
      "total_charge": "total_charge",
      "unit_of_measure": "unit_of_measure",
      "unit_rate": "unit_rate",
      "valid_from": "valid_from",
      "valid_to": "valid_to"
    },
    "product": {
      "product_code": "product_code",
      "product_description": "product_description"
    },
    "reference_id": "reference_id",
    "shipment_priority_code": "shipment_priority_code",
    "special_handling_codes": [
      "special_handling_codes"
    ],
    "time_of_availability": "time_of_availability",
    "transport_mode": "transport_mode"
  },
  "business_info": {
    "method_reason": "method_reason",
    "parties": [
      {}
    ],
    "service_method": "service_method"
  },
  "document_identifiers": [
    {
      "document_id": "document_id",
      "document_type": "document_type",
      "external_booking_reference_number": "external_booking_reference_number"
    }
  ],
  "message_header": {
    "message_id": "message_id",
    "request_id": "request_id"
  },
  "org_id": "org_id",
  "schema_version": 1,
  "synced_at": "2024-01-15T09:30:00Z",
  "task_group_id": "task_group_id",
  "response_status": {
    "statuses": [
      {}
    ]
  },
  "shipment": {
    "latest_acceptance_date": "latest_acceptance_date",
    "time_of_availability": "time_of_availability",
    "transport_mode": "transport_mode"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.staging.chrt.com/integrations/webcargo_bookings/sync/v1/task_group_id"

headers = {"Authorization": "Bearer <token>"}

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

print(response.json())
```

```javascript
const url = 'https://api.staging.chrt.com/integrations/webcargo_bookings/sync/v1/task_group_id';
const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};

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

```go
package main

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

func main() {

	url := "https://api.staging.chrt.com/integrations/webcargo_bookings/sync/v1/task_group_id"

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

	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
require 'uri'
require 'net/http'

url = URI("https://api.staging.chrt.com/integrations/webcargo_bookings/sync/v1/task_group_id")

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

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

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

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

HttpResponse<String> response = Unirest.post("https://api.staging.chrt.com/integrations/webcargo_bookings/sync/v1/task_group_id")
  .header("Authorization", "Bearer <token>")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.staging.chrt.com/integrations/webcargo_bookings/sync/v1/task_group_id', [
  'headers' => [
    'Authorization' => 'Bearer <token>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.staging.chrt.com/integrations/webcargo_bookings/sync/v1/task_group_id");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Authorization": "Bearer <token>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://api.staging.chrt.com/integrations/webcargo_bookings/sync/v1/task_group_id")! 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()
```