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

# Disable a carrier for a load's lane

POST https://tryenvoy.ai/api/v1/carriers/{carrier_id}/lane-preferences/disable-for-load
Content-Type: application/json

Mark a carrier as ineligible for the given load's origin->destination lane. Resolves the load's pickup/delivery, finds or creates the matching CarrierLanePreferenceH3, and flips it to is_active=False (preference_type is left untouched on existing rows). Search paths already filter on is_active=True, so the disable takes effect immediately, and ingestion will never flip an admin-disabled row back to active. Admin-only — requires OWNER or ADMIN role on the organization.

**Authentication:** Bearer token required.

Reference: https://docs.tryenvoy.ai/api-reference/endpoints/lane-preferences/disable-carrier-for-load-api-v-1-carriers-carrier-id-lane-preferences-disable-for-load-post

## Authentication

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

## Servers

- `https://tryenvoy.ai/api/v1` (Production, default)
- `https://staging.tryenvoy.ai/api/v1` (Staging)

## Request

### Path parameters

- `carrier_id` (string, required)

### Headers

- `X-Organization-ID` (string, optional, nullable)
- `Idempotency-Key` (string, optional) — A unique key (up to 255 printable ASCII characters, e.g. a UUID) that makes a retry of this request safe. Envoy stores the response for 24 hours; a retry with the same key and the same request returns it again with `Idempotent-Replayed: true` instead of running twice. The same key with a different request returns 422 `idempotency_key_reused`; while the first request is still running, 409 `idempotency_key_in_progress`. 5xx and 429 responses are not stored.

### Body (application/json)

This endpoint expects a DisableCarrierForLoadRequest.

- `load_id` (string, required) — Load id (accepts prefixed or raw UUID)

## Response

### 200

Successful Response

- `preference` (LanePreferenceResponse, required) — Minimal response for a toggled lane preference. Only the fields actually stored on ``CarrierLanePreferenceH3`` are surfaced. Origin/destination city+state live on the related ``Lane`` row and are intentionally not included here to avoid advertising fields we would never populate without a join. Clients that need lane geography can resolve it via ``lane_id``.
- `created` (boolean, required) — True when a fresh disabled row was created; False if an existing row was flipped inactive

## Errors

### 401 Unauthorized Error

Not authenticated - missing or invalid token/API key

- `any`

### 403 Forbidden Error

Insufficient permissions for this operation

- `any`

### 404 Not Found Error

Resource not found

- `any`

### 409 Conflict Error

`idempotency_key_in_progress`: a request with this Idempotency-Key is still running; retry later

- `any`

### 422 Unprocessable Entity Error

Validation Error; or `idempotency_key_reused`: this Idempotency-Key was already used for a different request

- `detail` (list of ValidationError, optional)

### 429 Too Many Requests Error

Rate limit exceeded - see Retry-After header

- `any`

## Types

### LanePreferenceResponse

Minimal response for a toggled lane preference. Only the fields actually stored on ``CarrierLanePreferenceH3`` are surfaced. Origin/destination city+state live on the related ``Lane`` row and are intentionally not included here to avoid advertising fields we would never populate without a join. Clients that need lane geography can resolve it via ``lane_id``.

- `id` (string, required)
- `carrier_id` (string, required)
- `lane_id` (string, required)
- `is_active` (boolean, required)
- `preference_type` (string, required)
- `routing_guide_tier` (integer, optional, nullable)
- `dnu` (boolean, optional, default: false)
- `dnu_reason` (string, optional, nullable)
- `dnu_set_at` (datetime, optional, nullable)
- `updated_at` (datetime, optional, nullable)

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)
- `input` (any, optional)
- `ctx` (ValidationErrorCtx, optional)

### ValidationErrorLocItems

### ValidationErrorCtx

## Examples

**Request**

```json
{
  "load_id": "string"
}
```

**Response**

```json
{
  "preference": {
    "id": "string",
    "carrier_id": "string",
    "lane_id": "string",
    "is_active": true,
    "preference_type": "string",
    "routing_guide_tier": 1,
    "dnu": false,
    "dnu_reason": "string",
    "dnu_set_at": "2024-01-15T09:30:00Z",
    "updated_at": "2024-01-15T09:30:00Z"
  },
  "created": true
}
```

**SDK Code**

```python
import requests

url = "https://tryenvoy.ai/api/v1/carriers/carrier_id/lane-preferences/disable-for-load"

payload = { "load_id": "string" }
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://tryenvoy.ai/api/v1/carriers/carrier_id/lane-preferences/disable-for-load';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"load_id":"string"}'
};

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"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://tryenvoy.ai/api/v1/carriers/carrier_id/lane-preferences/disable-for-load"

	payload := strings.NewReader("{\n  \"load_id\": \"string\"\n}")

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

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	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://tryenvoy.ai/api/v1/carriers/carrier_id/lane-preferences/disable-for-load")

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

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"load_id\": \"string\"\n}"

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://tryenvoy.ai/api/v1/carriers/carrier_id/lane-preferences/disable-for-load")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"load_id\": \"string\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://tryenvoy.ai/api/v1/carriers/carrier_id/lane-preferences/disable-for-load', [
  'body' => '{
  "load_id": "string"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://tryenvoy.ai/api/v1/carriers/carrier_id/lane-preferences/disable-for-load");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"load_id\": \"string\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = ["load_id": "string"] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://tryenvoy.ai/api/v1/carriers/carrier_id/lane-preferences/disable-for-load")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

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()
```