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

# Update batch

PATCH https://v1.getraya.app/api/batch/{id}
Content-Type: application/json

Updates batch properties such as name, schedule, max_retries, retry_after_hrs, or concurrency. Customer ID is automatically determined from the API key.

Reference: https://docs.getraya.app/api-reference/batches/update-batch

## Authentication

- `X-API-Key` header (required) — API key for authentication. Example: raya_ABCD1234567890abcdef

## Request

### Path parameters

- `id` (integer, required) — The batch ID

### Body (application/json)

This endpoint expects an UpdateBatchRequest.

- `name` (string, optional) — Batch name
- `schedule` (UpdateBatchRequestSchedule, optional) — Schedule configuration object for updating the batch schedule. The schedule defines when the batch should be active and making calls. All times are interpreted in the specified timezone. **Required fields:** * timezone: IANA timezone identifier (e.g., "Asia/Kolkata", "America/New\_York", "Europe/London", "UTC") * start\_time: Start time in "HH:mm" format using 24-hour clock (e.g., "09:00" for 9 AM, "18:30" for 6:30 PM) * end\_time: End time in "HH:mm" format using 24-hour clock (must be after start\_time) * days: Array of day numbers representing which days of the week the batch should run **Day Numbers:** * 1 = Monday * 2 = Tuesday * 3 = Wednesday * 4 = Thursday * 5 = Friday * 6 = Saturday * 7 = Sunday **Example:** \{"timezone": "Asia/Kolkata", "start\_time": "09:00", "end\_time": "18:00", "days": \[1,2,3,4,5]} This means the batch will run Monday through Friday from 9:00 AM to 6:00 PM India Standard Time (IST).
- `max_retries` (integer, optional) — Maximum number of retry attempts
- `retry_after_hrs` (double, optional) — Hours to wait before retrying
- `concurrency` (integer, optional) — Maximum concurrent calls

## Response

### 200

Batch updated successfully

- `id` (integer, optional)
- `name` (string, optional, nullable)
- `status` (string, optional, nullable)
- `agent_id` (string, optional)
- `created_at` (datetime, optional, nullable)
- `schedule` (BatchDetailsResponseSchedule, optional, nullable)
- `max_retries` (integer, optional)
- `concurrency` (integer, optional)
- `retry_after_hrs` (double, optional)
- `total_contacts` (integer, optional)
- `completed_contacts` (integer, optional)
- `unanswered_contacts` (integer, optional)

## Errors

### 404 Not Found Error

Batch not found or unauthorized

- `error` (string, optional)
- `message` (string, optional)

## Types

### UpdateBatchRequestSchedule

Schedule configuration object for updating the batch schedule. The schedule defines when the batch should be active and making calls. All times are interpreted in the specified timezone. **Required fields:** * timezone: IANA timezone identifier (e.g., "Asia/Kolkata", "America/New\_York", "Europe/London", "UTC") * start\_time: Start time in "HH:mm" format using 24-hour clock (e.g., "09:00" for 9 AM, "18:30" for 6:30 PM) * end\_time: End time in "HH:mm" format using 24-hour clock (must be after start\_time) * days: Array of day numbers representing which days of the week the batch should run **Day Numbers:** * 1 = Monday * 2 = Tuesday * 3 = Wednesday * 4 = Thursday * 5 = Friday * 6 = Saturday * 7 = Sunday **Example:** \{"timezone": "Asia/Kolkata", "start\_time": "09:00", "end\_time": "18:00", "days": \[1,2,3,4,5]} This means the batch will run Monday through Friday from 9:00 AM to 6:00 PM India Standard Time (IST).

- `timezone` (string, required) — IANA timezone identifier. This determines the timezone for interpreting start_time and end_time. Common examples: - "Asia/Kolkata" - India Standard Time (IST) - "America/New_York" - Eastern Time (ET) - "America/Los_Angeles" - Pacific Time (PT) - "Europe/London" - Greenwich Mean Time / British Summer Time - "UTC" - Coordinated Universal Time The timezone must be a valid IANA timezone string in the format "Region/City".
- `start_time` (string, required) — Start time when the batch should begin making calls. Format: "HH:mm" using 24-hour clock (00:00 to 23:59) - Hours: 00-23 (00 = midnight, 12 = noon, 23 = 11 PM) - Minutes: 00-59 Examples: - "09:00" = 9:00 AM - "14:30" = 2:30 PM - "00:00" = Midnight - "23:59" = 11:59 PM This time is interpreted in the timezone specified in the timezone field.
- `end_time` (string, required) — End time when the batch should stop making calls. Format: "HH:mm" using 24-hour clock (00:00 to 23:59) - Hours: 00-23 (00 = midnight, 12 = noon, 23 = 11 PM) - Minutes: 00-59 Examples: - "18:00" = 6:00 PM - "17:30" = 5:30 PM - "23:59" = 11:59 PM **Important:** end_time must be after start_time. For example, if start_time is "09:00", end_time must be later than "09:00" on the same day. This time is interpreted in the timezone specified in the timezone field.
- `days` (list of integer, required) — Array of day numbers representing which days of the week the batch should be active. **Day Number Mapping:** - 1 = Monday - 2 = Tuesday - 3 = Wednesday - 4 = Thursday - 5 = Friday - 6 = Saturday - 7 = Sunday **Examples:** - [1, 2, 3, 4, 5] = Monday through Friday (weekdays) - [6, 7] = Saturday and Sunday (weekends) - [1, 3, 5] = Monday, Wednesday, Friday - [1, 2, 3, 4, 5, 6, 7] = Every day of the week The batch will only make calls on the specified days, during the time window defined by start_time and end_time.

### BatchDetailsResponseSchedule

- `timezone` (string, required) — IANA timezone string
- `start_time` (string, required) — Start time in "HH:mm" format (24-hour)
- `end_time` (string, required) — End time in "HH:mm" format (24-hour)
- `days` (list of integer, required) — Array of day numbers (1=Monday, 7=Sunday)

## Examples

**Request**

```json
{}
```

**Response**

```json
{
  "id": 1,
  "name": "string",
  "status": "string",
  "agent_id": "string",
  "created_at": "2024-01-15T09:30:00Z",
  "schedule": {
    "timezone": "Asia/Kolkata",
    "start_time": "09:00",
    "end_time": "18:00",
    "days": [
      1,
      2,
      3,
      4,
      5
    ]
  },
  "max_retries": 1,
  "concurrency": 1,
  "retry_after_hrs": 1.1,
  "total_contacts": 1,
  "completed_contacts": 1,
  "unanswered_contacts": 1
}
```

**SDK Code**

```python
import requests

url = "https://v1.getraya.app/api/batch/1"

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

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

print(response.json())
```

```javascript
const url = 'https://v1.getraya.app/api/batch/1';
const options = {
  method: 'PATCH',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{}'
};

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://v1.getraya.app/api/batch/1"

	payload := strings.NewReader("{}")

	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://v1.getraya.app/api/batch/1")

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 = "{}"

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://v1.getraya.app/api/batch/1")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('PATCH', 'https://v1.getraya.app/api/batch/1', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://v1.getraya.app/api/batch/1");
var request = new RestRequest(Method.PATCH);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

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

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

let request = NSMutableURLRequest(url: NSURL(string: "https://v1.getraya.app/api/batch/1")! 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()
```