# Update Block Slot

PUT https://services.leadconnectorhq.com/calendars/events/block-slots/{eventId}

Update block slot by ID

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `calendars/events.write`

## Parameters

### Header Parameters

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

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `eventId` | string | Yes | Event Id or Instance id. For recurring appointments send masterEventId to modify original series. |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/calendars/events/block-slots/{eventId}": {
      "put": {
        "summary": "Update Block Slot",
        "operationId": "updateBlockSlot",
        "description": "Update block slot by ID",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "v3"
              ]
            }
          },
          {
            "name": "eventId",
            "required": true,
            "in": "path",
            "description": "Event Id or Instance id. For recurring appointments send masterEventId to modify original series.",
            "examples": {
              "example1": {
                "summary": "Event ID",
                "value": "ocQHyuzHvysMo5N5VsXc"
              },
              "example2": {
                "summary": "Recurring Instance ID",
                "value": "ocQHyuzHvysMo5N5VsXc_1729821600000_1800"
              }
            },
            "schema": {
              "type": "string",
              "example": "ocQHyuzHvysMo5N5VsXc"
            }
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/BlockSlotEditRequestDTO"
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BlockedSlotSuccessfulResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": [
              "calendars/events.write"
            ]
          }
        ]
      }
    }
  },
  "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"
      },
      "Location-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as 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"
      },
      "Agency-Access-Only": {
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "name": "Authorization",
        "in": "header",
        "description": "Use the Access Token generated with user type as Agency.",
        "type": "http"
      }
    },
    "schemas": {
      "BlockSlotEditRequestDTO": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "description": "Title",
            "example": "Test Event"
          },
          "calendarId": {
            "type": "string",
            "description": "Either calendarId or assignedUserId can be set, not both. Event (class) calendars only. To block time on any other calendar type, leave calendarId out and set assignedUserId to the host's user id: that blocks the host on every calendar they host.",
            "example": "CVokAlI8fgw4WYWoCtQz"
          },
          "assignedUserId": {
            "type": "string",
            "description": "Either calendarId or assignedUserId can be set, not both. The user whose time is blocked. Use this, not calendarId, for personal, round robin and collective calendars.",
            "example": "CVokAlI8fgw4WYWoCtQz"
          },
          "locationId": {
            "type": "string",
            "description": "Location Id",
            "example": "C2QujeCh8ZnC7al2InWR"
          },
          "startTime": {
            "type": "string",
            "description": "Start Time. ISO 8601 with the UTC offset, e.g. 2026-11-09T14:00:00+05:30. A time without an offset is read as UTC.",
            "example": "2021-06-23T03:30:00+05:30"
          },
          "endTime": {
            "type": "string",
            "description": "End Time. ISO 8601 with the UTC offset, e.g. 2026-11-09T14:00:00+05:30. A time without an offset is read as UTC.",
            "example": "2021-06-23T04:30:00+05:30"
          }
        },
        "required": [
          "calendarId",
          "locationId"
        ],
        "title": "BlockSlotEditRequestDTO"
      },
      "BlockedSlotSuccessfulResponseDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Id",
            "example": "0TkCdp9PfvLeWKYRRvIz"
          },
          "locationId": {
            "type": "string",
            "description": "Location Id",
            "example": "C2QujeCh8ZnC7al2InWR"
          },
          "title": {
            "type": "string",
            "description": "Title",
            "example": "My event"
          },
          "startTime": {
            "type": "object",
            "description": "Start Time",
            "example": "2021-06-23T03:30:00+05:30"
          },
          "endTime": {
            "type": "object",
            "description": "End Time",
            "example": "2021-06-23T04:30:00+05:30"
          },
          "calendarId": {
            "type": "string",
            "description": "Calendar id",
            "example": "CVokAlI8fgw4WYWoCtQz"
          },
          "assignedUserId": {
            "type": "string",
            "description": "Assigned User Id",
            "example": "0007BWpSzSwfiuSl0tR2"
          }
        },
        "required": [
          "id",
          "locationId",
          "title",
          "startTime",
          "endTime"
        ],
        "title": "BlockedSlotSuccessfulResponseDto"
      },
      "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"
      }
    }
  }
}
```

## 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 = {
  "title": "Test Event",
  "calendarId": "CVokAlI8fgw4WYWoCtQz",
  "assignedUserId": "CVokAlI8fgw4WYWoCtQz",
  "locationId": "C2QujeCh8ZnC7al2InWR",
  "startTime": "2021-06-23T03:30:00+05:30",
  "endTime": "2021-06-23T04:30:00+05:30"
};

const response = await ghl.calendars.updateBlockSlot('<EVENTID>', body);
console.log(response);
```

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

```python
from highlevel import HighLevel

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

body = {
    "title": "Test Event",
    "calendarId": "CVokAlI8fgw4WYWoCtQz",
    "assignedUserId": "CVokAlI8fgw4WYWoCtQz",
    "locationId": "C2QujeCh8ZnC7al2InWR",
    "startTime": "2021-06-23T03:30:00+05:30",
    "endTime": "2021-06-23T04:30:00+05:30"
}

response = await client.calendars.update_block_slot('<EVENTID>', 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 = [
    'title' => 'Test Event',
    'calendarId' => 'CVokAlI8fgw4WYWoCtQz',
    'assignedUserId' => 'CVokAlI8fgw4WYWoCtQz',
    'locationId' => 'C2QujeCh8ZnC7al2InWR',
    'startTime' => '2021-06-23T03:30:00+05:30',
    'endTime' => '2021-06-23T04:30:00+05:30'
];

$response = $ghl->calendars->updateBlockSlot('<EVENTID>', $body);
echo json_encode($response, JSON_PRETTY_PRINT);
```

## Code Examples

**cURL**

```bash
curl -L -X PUT 'https://services.leadconnectorhq.com/calendars/events/block-slots/<eventId>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "title": "Test Event",
  "calendarId": "CVokAlI8fgw4WYWoCtQz",
  "assignedUserId": "CVokAlI8fgw4WYWoCtQz",
  "locationId": "C2QujeCh8ZnC7al2InWR",
  "startTime": "2021-06-23T03:30:00+05:30",
  "endTime": "2021-06-23T04:30:00+05:30"
}'
```

**Node.js**

```javascript
const options = {
  method: 'PUT',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: 'v3',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
      "title": "Test Event",
      "calendarId": "CVokAlI8fgw4WYWoCtQz",
      "assignedUserId": "CVokAlI8fgw4WYWoCtQz",
      "locationId": "C2QujeCh8ZnC7al2InWR",
      "startTime": "2021-06-23T03:30:00+05:30",
      "endTime": "2021-06-23T04:30:00+05:30"
  })
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/calendars/events/block-slots/<eventId>', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/calendars/events/block-slots/{eventId}"

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

payload = {
    "title": "Test Event",
    "calendarId": "CVokAlI8fgw4WYWoCtQz",
    "assignedUserId": "CVokAlI8fgw4WYWoCtQz",
    "locationId": "C2QujeCh8ZnC7al2InWR",
    "startTime": "2021-06-23T03:30:00+05:30",
    "endTime": "2021-06-23T04:30:00+05:30"
}

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/calendars/events/block-slots/<eventId>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'PUT',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
    'Content-Type: application/json',
  ],
  CURLOPT_POSTFIELDS => '{
  "title": "Test Event",
  "calendarId": "CVokAlI8fgw4WYWoCtQz",
  "assignedUserId": "CVokAlI8fgw4WYWoCtQz",
  "locationId": "C2QujeCh8ZnC7al2InWR",
  "startTime": "2021-06-23T03:30:00+05:30",
  "endTime": "2021-06-23T04:30:00+05:30"
}',
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .put("https://services.leadconnectorhq.com/calendars/events/block-slots/<eventId>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .header("Content-Type", "application/json")
  .body("{\"title\":\"Test Event\",\"calendarId\":\"CVokAlI8fgw4WYWoCtQz\",\"assignedUserId\":\"CVokAlI8fgw4WYWoCtQz\",\"locationId\":\"C2QujeCh8ZnC7al2InWR\",\"startTime\":\"2021-06-23T03:30:00+05:30\",\"endTime\":\"2021-06-23T04:30:00+05:30\"}")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/calendars/events/block-slots/<eventId>"
  payload := strings.NewReader(`{
  "title": "Test Event",
  "calendarId": "CVokAlI8fgw4WYWoCtQz",
  "assignedUserId": "CVokAlI8fgw4WYWoCtQz",
  "locationId": "C2QujeCh8ZnC7al2InWR",
  "startTime": "2021-06-23T03:30:00+05:30",
  "endTime": "2021-06-23T04:30:00+05:30"
}`)
  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/calendars/events/block-slots/<eventId>")

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 = '{
  "title": "Test Event",
  "calendarId": "CVokAlI8fgw4WYWoCtQz",
  "assignedUserId": "CVokAlI8fgw4WYWoCtQz",
  "locationId": "C2QujeCh8ZnC7al2InWR",
  "startTime": "2021-06-23T03:30:00+05:30",
  "endTime": "2021-06-23T04:30:00+05:30"
}'

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

**PowerShell**

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

$body = '{
  "title": "Test Event",
  "calendarId": "CVokAlI8fgw4WYWoCtQz",
  "assignedUserId": "CVokAlI8fgw4WYWoCtQz",
  "locationId": "C2QujeCh8ZnC7al2InWR",
  "startTime": "2021-06-23T03:30:00+05:30",
  "endTime": "2021-06-23T04:30:00+05:30"
}'

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/calendars/events/block-slots/<eventId>' -Method 'PUT' -Headers $headers -Body $body -ContentType 'application/json'
$response | ConvertTo-Json
```
