> This page is for version v4.0.
> For other versions, use one of these documentation indexes:
> - v5.0 (default): https://humanloop.com/docs/v5/llms.txt
> - v4.0: https://humanloop.com/docs/v4/llms.txt

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

# Deploy Config

PATCH https://api.humanloop.com/v4/projects/{project_id}/deploy-config
Content-Type: application/json

Deploy a model config to an environment.

If the environment already has a model config deployed, it will be replaced.

Reference: https://humanloop.com/docs/v4/api/projects/deployed-config/deploy

## Authentication

- `X-API-KEY` header (required) — API Key authentication via header

## Request

### Path parameters

- `project_id` (string, required)

### Body (application/json)

This endpoint expects an object.

- `config_id` (string, required) — Model config unique identifier generated by Humanloop.
- `environments` (list of EnvironmentRequest, optional) — List of environments to associate with the model config.

## Response

### 200

Successful Response

- `list of EnvironmentProjectConfigResponse`

## Errors

### 422 Deployed Config Deploy Request Unprocessable Entity Error

Validation Error

- `detail` (list of ValidationError, optional)

## Types

### EnvironmentRequest

- `id` (string, required) — String ID of the environment. Starts with `env_`.
- `name` (string, optional) — The environment name.

### EnvironmentProjectConfigResponse

- `project_id` (string, required) — String ID of project the model config belongs to. Starts with `pr_`.
- `project_name` (string, required) — Name of the project the model config belongs to.
- `environment_id` (string, required) — The ID of the environment.
- `environment_name` (string, required) — The name of the environment.
- `environment_tag` (string, required) — Tag for the environment e.g. 'default' or 'other'.
- `model_config_id` (string, optional) — Model config unique identifier generated by Humanloop.
- `model_config_name` (string, optional) — A friendly display name for the model config.

### ValidationError

- `loc` (list of ValidationErrorLocItem, required)
- `msg` (string, required)
- `type` (string, required)

### ValidationErrorLocItem

## Examples

**Request**

```json
{
  "config_id": "config_id"
}
```

**Response**

```json
[
  {
    "project_id": "project_id",
    "project_name": "project_name",
    "environment_id": "environment_id",
    "environment_name": "environment_name",
    "environment_tag": "environment_tag",
    "model_config_id": "model_config_id",
    "model_config_name": "model_config_name"
  }
]
```

**SDK Code**

```python
import requests

url = "https://api.humanloop.com/v4/projects/project_id/deploy-config"

payload = { "config_id": "config_id" }
headers = {
    "X-API-KEY": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://api.humanloop.com/v4/projects/project_id/deploy-config';
const options = {
  method: 'PATCH',
  headers: {'X-API-KEY': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"config_id":"config_id"}'
};

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://api.humanloop.com/v4/projects/project_id/deploy-config"

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

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

	req.Header.Add("X-API-KEY", "<apiKey>")
	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://api.humanloop.com/v4/projects/project_id/deploy-config")

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

request = Net::HTTP::Patch.new(url)
request["X-API-KEY"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"config_id\": \"config_id\"\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.patch("https://api.humanloop.com/v4/projects/project_id/deploy-config")
  .header("X-API-KEY", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"config_id\": \"config_id\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://api.humanloop.com/v4/projects/project_id/deploy-config', [
  'body' => '{
  "config_id": "config_id"
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-KEY' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.humanloop.com/v4/projects/project_id/deploy-config");
var request = new RestRequest(Method.PATCH);
request.AddHeader("X-API-KEY", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"config_id\": \"config_id\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-KEY": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = ["config_id": "config_id"] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.humanloop.com/v4/projects/project_id/deploy-config")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PATCH"
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()
```