# Update Shipping Carrier

PUT https://services.leadconnectorhq.com/store/shipping-carrier/{shippingCarrierId}

The "update Shipping Carrier" API allows update a shipping carrier to the system. 

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** No scopes required.

## Parameters

### Header Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `Version` | string | Yes | API Version |

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `shippingCarrierId` | string | Yes | ID of the shipping carrier that needs to be returned |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/store/shipping-carrier/{shippingCarrierId}": {
      "put": {
        "summary": "Update Shipping Carrier",
        "operationId": "updateShippingCarrier",
        "description": "The \"update Shipping Carrier\" API allows update a shipping carrier to the system. ",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "required": true,
            "description": "API Version",
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "shippingCarrierId",
            "required": true,
            "in": "path",
            "description": "ID of the shipping carrier that needs to be returned",
            "schema": {
              "example": "6578278e879ad2646715ba9c",
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateShippingCarrierDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateShippingCarrierResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "422": {
            "description": "Unprocessable Entity",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnprocessableDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "Location-Access": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearer": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Location-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Sub-Account (OR) Private Integration Token of Sub-Account.",
        "type": "http"
      },
      "Agency-Access": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency (OR) Private Integration Token of Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "UpdateShippingCarrierDto": {
        "type": "object",
        "properties": {
          "altId": {
            "type": "string",
            "description": "Location Id or Agency Id",
            "example": "6578278e879ad2646715ba9c"
          },
          "altType": {
            "type": "string",
            "enum": [
              "location"
            ]
          },
          "name": {
            "type": "string",
            "description": "Name of the shipping carrier",
            "example": "FedEx"
          },
          "callbackUrl": {
            "type": "string",
            "description": "The URL endpoint that CRM needs to retrieve shipping rates. This must be a public URL.",
            "example": "https://example.com/get-shipping-rates"
          },
          "services": {
            "description": "An array of available shipping carrier services",
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": {
                  "type": "string",
                  "description": "Name of the shipping carrier service",
                  "example": "Priority Mail Express International"
                },
                "value": {
                  "type": "string",
                  "description": "Value of the shipping carrier service",
                  "example": "PriorityMailExpressInternational"
                }
              },
              "required": [
                "name",
                "value"
              ],
              "title": "ShippingCarrierServiceDto"
            }
          },
          "allowsMultipleServiceSelection": {
            "type": "boolean",
            "description": "The seller can choose multiple services while creating shipping rates if this is true.",
            "example": true
          }
        },
        "title": "UpdateShippingCarrierDto"
      },
      "UpdateShippingCarrierResponseDto": {
        "type": "object",
        "properties": {
          "status": {
            "type": "boolean",
            "description": "Status of api action",
            "example": true
          },
          "message": {
            "type": "string",
            "description": "Success message",
            "example": "Successfully created"
          },
          "data": {
            "description": "Shipping carrier data",
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "altId": {
                    "type": "string",
                    "description": "Location Id or Agency Id",
                    "example": "6578278e879ad2646715ba9c"
                  },
                  "altType": {
                    "type": "string",
                    "enum": [
                      "location"
                    ]
                  },
                  "name": {
                    "type": "string",
                    "description": "Name of the shipping carrier",
                    "example": "FedEx"
                  },
                  "callbackUrl": {
                    "type": "string",
                    "description": "The URL endpoint that CRM needs to retrieve shipping rates. This must be a public URL.",
                    "example": "https://example.com/get-shipping-rates"
                  },
                  "services": {
                    "description": "An array of available shipping carrier services",
                    "type": "array",
                    "items": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "description": "Name of the shipping carrier service",
                          "example": "Priority Mail Express International"
                        },
                        "value": {
                          "type": "string",
                          "description": "Value of the shipping carrier service",
                          "example": "PriorityMailExpressInternational"
                        }
                      },
                      "required": [
                        "name",
                        "value"
                      ],
                      "title": "ShippingCarrierServiceDto"
                    }
                  },
                  "allowsMultipleServiceSelection": {
                    "type": "boolean",
                    "description": "The seller can choose multiple services while creating shipping rates if this is true.",
                    "example": true
                  },
                  "_id": {
                    "type": "string",
                    "description": "The unique identifier for the product.",
                    "example": "655b33a82209e60b6adb87a5"
                  },
                  "marketplaceAppId": {
                    "type": "string",
                    "description": "The unique identifier for the marketplace app.",
                    "example": "655b33a82209e60b6adb87a5"
                  },
                  "createdAt": {
                    "type": "string",
                    "description": "created at",
                    "example": "2023-12-12T09:27:42.355Z"
                  },
                  "updatedAt": {
                    "type": "string",
                    "description": "updated at",
                    "example": "2023-12-12T09:27:42.355Z"
                  }
                },
                "required": [
                  "altId",
                  "altType",
                  "name",
                  "callbackUrl",
                  "_id",
                  "marketplaceAppId",
                  "createdAt",
                  "updatedAt"
                ],
                "title": "ShippingCarrierSchema"
              }
            ]
          }
        },
        "required": [
          "status",
          "data"
        ],
        "title": "UpdateShippingCarrierResponseDto"
      },
      "BadRequestDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 400
          },
          "message": {
            "type": "string",
            "example": "Bad Request"
          }
        },
        "title": "BadRequestDTO"
      },
      "UnauthorizedDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 401
          },
          "message": {
            "type": "string",
            "example": "Invalid token: access token is invalid"
          },
          "error": {
            "type": "string",
            "example": "Unauthorized"
          }
        },
        "title": "UnauthorizedDTO"
      },
      "UnprocessableDTO": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 422
          },
          "message": {
            "example": [
              "Unprocessable Entity"
            ],
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "error": {
            "type": "string",
            "example": "Unprocessable Entity"
          }
        },
        "title": "UnprocessableDTO"
      }
    }
  }
}
```

## HighLevel SDK Examples

**Node.js** (`@gohighlevel/api-client`)

```javascript
import HighLevel from '@gohighlevel/api-client';

const ghl = new HighLevel({
  privateIntegrationToken: '<PRIVATE_INTEGRATION_TOKEN>'
});

const body = {
  "altId": "6578278e879ad2646715ba9c",
  "name": "FedEx",
  "callbackUrl": "https://example.com/get-shipping-rates",
  "services": [
    {
      "name": "Priority Mail Express International",
      "value": "PriorityMailExpressInternational"
    }
  ],
  "allowsMultipleServiceSelection": true
};

const response = await ghl.store.updateShippingCarrier('<SHIPPINGCARRIERID>', body);
console.log(response);
```

**Python** (`gohighlevel-api-client`)

```python
from highlevel import HighLevel

client = HighLevel(
    private_integration_token='<PRIVATE_INTEGRATION_TOKEN>'
)

body = {
    "altId": "6578278e879ad2646715ba9c",
    "name": "FedEx",
    "callbackUrl": "https://example.com/get-shipping-rates",
    "services": [
        {
            "name": "Priority Mail Express International",
            "value": "PriorityMailExpressInternational"
        }
    ],
    "allowsMultipleServiceSelection": true
}

response = await client.store.update_shipping_carrier('<SHIPPINGCARRIERID>', body=body)
print(response)
```

**PHP** (`gohighlevel/api-client`)

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

use HighLevel\HighLevel;
use HighLevel\HighLevelConfig;

$config = new HighLevelConfig([
    'privateIntegrationToken' => '<PRIVATE_INTEGRATION_TOKEN>'
]);
$ghl = new HighLevel($config);

$body = [
    'altId' => '6578278e879ad2646715ba9c',
    'name' => 'FedEx',
    'callbackUrl' => 'https://example.com/get-shipping-rates',
    'services' => [
        [
            'name' => 'Priority Mail Express International',
            'value' => 'PriorityMailExpressInternational'
        ]
    ],
    'allowsMultipleServiceSelection' => true
];

$response = $ghl->store->updateShippingCarrier('<SHIPPINGCARRIERID>', $body);
echo json_encode($response, JSON_PRETTY_PRINT);
```

## Code Examples

**cURL**

```bash
curl -L -X PUT 'https://services.leadconnectorhq.com/store/shipping-carrier/<shippingCarrierId>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "altId": "6578278e879ad2646715ba9c",
  "name": "FedEx",
  "callbackUrl": "https://example.com/get-shipping-rates",
  "services": [
    {
      "name": "Priority Mail Express International",
      "value": "PriorityMailExpressInternational"
    }
  ],
  "allowsMultipleServiceSelection": true
}'
```

**Node.js**

```javascript
const options = {
  method: 'PUT',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "altId": "6578278e879ad2646715ba9c",
      "name": "FedEx",
      "callbackUrl": "https://example.com/get-shipping-rates",
      "services": [
        {
          "name": "Priority Mail Express International",
          "value": "PriorityMailExpressInternational"
        }
      ],
      "allowsMultipleServiceSelection": true
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/store/shipping-carrier/<shippingCarrierId>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/store/shipping-carrier/{shippingCarrierId}"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "v3"
}

payload = {
    "altId": "6578278e879ad2646715ba9c",
    "name": "FedEx",
    "callbackUrl": "https://example.com/get-shipping-rates",
    "services": [
        {
            "name": "Priority Mail Express International",
            "value": "PriorityMailExpressInternational"
        }
    ],
    "allowsMultipleServiceSelection": true
}

response = requests.put(url, json=payload, headers=headers)
print(response.json())
```

**PHP**

```php
<?php
$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/store/shipping-carrier/<shippingCarrierId>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'PUT',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "altId": "6578278e879ad2646715ba9c",
  "name": "FedEx",
  "callbackUrl": "https://example.com/get-shipping-rates",
  "services": [
    {
      "name": "Priority Mail Express International",
      "value": "PriorityMailExpressInternational"
    }
  ],
  "allowsMultipleServiceSelection": true
}',
]);

$response = curl_exec($curl);
curl_close($curl);
echo $response;
```

**Java**

```java
HttpResponse<String> response = Unirest
  .put("https://services.leadconnectorhq.com/store/shipping-carrier/<shippingCarrierId>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .header("Content-Type", "application/json")
  .body("{\"altId\":\"6578278e879ad2646715ba9c\",\"name\":\"FedEx\",\"callbackUrl\":\"https://example.com/get-shipping-rates\",\"services\":[{\"name\":\"Priority Mail Express International\",\"value\":\"PriorityMailExpressInternational\"}],\"allowsMultipleServiceSelection\":true}")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/store/shipping-carrier/<shippingCarrierId>"
  payload := strings.NewReader(`{
  "altId": "6578278e879ad2646715ba9c",
  "name": "FedEx",
  "callbackUrl": "https://example.com/get-shipping-rates",
  "services": [
    {
      "name": "Priority Mail Express International",
      "value": "PriorityMailExpressInternational"
    }
  ],
  "allowsMultipleServiceSelection": true
}`)
  req, _ := http.NewRequest("PUT", url, payload)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "v3")

  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := io.ReadAll(res.Body)
  fmt.Println(string(body))
}
```

**Ruby**

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

url = URI("https://services.leadconnectorhq.com/store/shipping-carrier/<shippingCarrierId>")

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

request = Net::HTTP::Put.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "v3"
request["Content-Type"] = "application/json"
request.body = '{
  "altId": "6578278e879ad2646715ba9c",
  "name": "FedEx",
  "callbackUrl": "https://example.com/get-shipping-rates",
  "services": [
    {
      "name": "Priority Mail Express International",
      "value": "PriorityMailExpressInternational"
    }
  ],
  "allowsMultipleServiceSelection": true
}'

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

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "v3"
}

$body = '{
  "altId": "6578278e879ad2646715ba9c",
  "name": "FedEx",
  "callbackUrl": "https://example.com/get-shipping-rates",
  "services": [
    {
      "name": "Priority Mail Express International",
      "value": "PriorityMailExpressInternational"
    }
  ],
  "allowsMultipleServiceSelection": true
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/store/shipping-carrier/<shippingCarrierId>' -Method 'PUT' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
