# Get Agent Working Hours

GET https://services.leadconnectorhq.com/conversation-ai/agents/{agentId}/working-hours

Retrieves the working-hours configuration for an AI agent: the weekly schedule, the channels it applies to, the timezone mode, and the off-hours auto-reply and follow-up settings.

## Authentication

Send `Authorization: Bearer <token>` using:

- **Sub-Account token: OAuth access token or Private Integration Token.** Scopes: `conversation-ai.readonly`

## Parameters

### Header Parameters

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

### Path Parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `agentId` | string | Yes | Conversations AI agent id |

## OpenAPI Specification

```json
{
  "openapi": "3.0.0",
  "info": {
    "title": "HighLevel API",
    "version": "2023-02-21"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/conversation-ai/agents/{agentId}/working-hours": {
      "get": {
        "summary": "Get Agent Working Hours",
        "operationId": "getAgentWorkingHours",
        "description": "Retrieves the working-hours configuration for an AI agent: the weekly schedule, the channels it applies to, the timezone mode, and the off-hours auto-reply and follow-up settings.",
        "parameters": [
          {
            "name": "Version",
            "in": "header",
            "description": "API Version",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "2023-02-21"
              ]
            }
          },
          {
            "name": "agentId",
            "required": true,
            "in": "path",
            "description": "Conversations AI agent id",
            "schema": {
              "example": "EmployeeId123",
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkingHoursConfigResponseDto"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/BadRequestDTO"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UnauthorizedDTO"
                }
              }
            }
          },
          "404": {
            "description": "Not configured",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkingHoursNotFoundDto"
                }
              }
            }
          }
        },
        "security": [
          {
            "bearer": [
              "conversation-ai.readonly"
            ]
          }
        ]
      }
    }
  },
  "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": {
      "WorkingHoursConfigResponseDto": {
        "type": "object",
        "properties": {
          "data": {
            "type": "object",
            "properties": {
              "enabled": {
                "type": "boolean",
                "example": false,
                "description": "Master toggle for working hours."
              },
              "channels": {
                "type": "array",
                "example": [
                  "SMS",
                  "WhatsApp"
                ],
                "description": "Channels the gate applies to. Must be non-empty when enabled.",
                "items": {
                  "type": "string",
                  "enum": [
                    "SMS",
                    "Email",
                    "WhatsApp",
                    "IG",
                    "FB",
                    "WebChat",
                    "Live_Chat",
                    "TIKTOK"
                  ]
                }
              },
              "timezoneMode": {
                "type": "string",
                "enum": [
                  "contact",
                  "business"
                ]
              },
              "schedule": {
                "type": "object",
                "properties": {
                  "mon": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean",
                        "example": true
                      },
                      "slots": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "startHour": {
                              "type": "number",
                              "example": 9,
                              "minimum": 0,
                              "maximum": 23
                            },
                            "startMinute": {
                              "type": "number",
                              "example": 0,
                              "minimum": 0,
                              "maximum": 59
                            },
                            "endHour": {
                              "type": "number",
                              "example": 17,
                              "minimum": 0,
                              "maximum": 23
                            },
                            "endMinute": {
                              "type": "number",
                              "example": 0,
                              "minimum": 0,
                              "maximum": 59
                            }
                          },
                          "required": [
                            "startHour",
                            "startMinute",
                            "endHour",
                            "endMinute"
                          ],
                          "title": "TimeSlotDto"
                        }
                      }
                    },
                    "required": [
                      "enabled",
                      "slots"
                    ],
                    "title": "DayScheduleDto"
                  },
                  "tue": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean",
                        "example": true
                      },
                      "slots": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "startHour": {
                              "type": "number",
                              "example": 9,
                              "minimum": 0,
                              "maximum": 23
                            },
                            "startMinute": {
                              "type": "number",
                              "example": 0,
                              "minimum": 0,
                              "maximum": 59
                            },
                            "endHour": {
                              "type": "number",
                              "example": 17,
                              "minimum": 0,
                              "maximum": 23
                            },
                            "endMinute": {
                              "type": "number",
                              "example": 0,
                              "minimum": 0,
                              "maximum": 59
                            }
                          },
                          "required": [
                            "startHour",
                            "startMinute",
                            "endHour",
                            "endMinute"
                          ],
                          "title": "TimeSlotDto"
                        }
                      }
                    },
                    "required": [
                      "enabled",
                      "slots"
                    ],
                    "title": "DayScheduleDto"
                  },
                  "wed": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean",
                        "example": true
                      },
                      "slots": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "startHour": {
                              "type": "number",
                              "example": 9,
                              "minimum": 0,
                              "maximum": 23
                            },
                            "startMinute": {
                              "type": "number",
                              "example": 0,
                              "minimum": 0,
                              "maximum": 59
                            },
                            "endHour": {
                              "type": "number",
                              "example": 17,
                              "minimum": 0,
                              "maximum": 23
                            },
                            "endMinute": {
                              "type": "number",
                              "example": 0,
                              "minimum": 0,
                              "maximum": 59
                            }
                          },
                          "required": [
                            "startHour",
                            "startMinute",
                            "endHour",
                            "endMinute"
                          ],
                          "title": "TimeSlotDto"
                        }
                      }
                    },
                    "required": [
                      "enabled",
                      "slots"
                    ],
                    "title": "DayScheduleDto"
                  },
                  "thu": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean",
                        "example": true
                      },
                      "slots": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "startHour": {
                              "type": "number",
                              "example": 9,
                              "minimum": 0,
                              "maximum": 23
                            },
                            "startMinute": {
                              "type": "number",
                              "example": 0,
                              "minimum": 0,
                              "maximum": 59
                            },
                            "endHour": {
                              "type": "number",
                              "example": 17,
                              "minimum": 0,
                              "maximum": 23
                            },
                            "endMinute": {
                              "type": "number",
                              "example": 0,
                              "minimum": 0,
                              "maximum": 59
                            }
                          },
                          "required": [
                            "startHour",
                            "startMinute",
                            "endHour",
                            "endMinute"
                          ],
                          "title": "TimeSlotDto"
                        }
                      }
                    },
                    "required": [
                      "enabled",
                      "slots"
                    ],
                    "title": "DayScheduleDto"
                  },
                  "fri": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean",
                        "example": true
                      },
                      "slots": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "startHour": {
                              "type": "number",
                              "example": 9,
                              "minimum": 0,
                              "maximum": 23
                            },
                            "startMinute": {
                              "type": "number",
                              "example": 0,
                              "minimum": 0,
                              "maximum": 59
                            },
                            "endHour": {
                              "type": "number",
                              "example": 17,
                              "minimum": 0,
                              "maximum": 23
                            },
                            "endMinute": {
                              "type": "number",
                              "example": 0,
                              "minimum": 0,
                              "maximum": 59
                            }
                          },
                          "required": [
                            "startHour",
                            "startMinute",
                            "endHour",
                            "endMinute"
                          ],
                          "title": "TimeSlotDto"
                        }
                      }
                    },
                    "required": [
                      "enabled",
                      "slots"
                    ],
                    "title": "DayScheduleDto"
                  },
                  "sat": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean",
                        "example": true
                      },
                      "slots": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "startHour": {
                              "type": "number",
                              "example": 9,
                              "minimum": 0,
                              "maximum": 23
                            },
                            "startMinute": {
                              "type": "number",
                              "example": 0,
                              "minimum": 0,
                              "maximum": 59
                            },
                            "endHour": {
                              "type": "number",
                              "example": 17,
                              "minimum": 0,
                              "maximum": 23
                            },
                            "endMinute": {
                              "type": "number",
                              "example": 0,
                              "minimum": 0,
                              "maximum": 59
                            }
                          },
                          "required": [
                            "startHour",
                            "startMinute",
                            "endHour",
                            "endMinute"
                          ],
                          "title": "TimeSlotDto"
                        }
                      }
                    },
                    "required": [
                      "enabled",
                      "slots"
                    ],
                    "title": "DayScheduleDto"
                  },
                  "sun": {
                    "type": "object",
                    "properties": {
                      "enabled": {
                        "type": "boolean",
                        "example": true
                      },
                      "slots": {
                        "type": "array",
                        "items": {
                          "type": "object",
                          "properties": {
                            "startHour": {
                              "type": "number",
                              "example": 9,
                              "minimum": 0,
                              "maximum": 23
                            },
                            "startMinute": {
                              "type": "number",
                              "example": 0,
                              "minimum": 0,
                              "maximum": 59
                            },
                            "endHour": {
                              "type": "number",
                              "example": 17,
                              "minimum": 0,
                              "maximum": 23
                            },
                            "endMinute": {
                              "type": "number",
                              "example": 0,
                              "minimum": 0,
                              "maximum": 59
                            }
                          },
                          "required": [
                            "startHour",
                            "startMinute",
                            "endHour",
                            "endMinute"
                          ],
                          "title": "TimeSlotDto"
                        }
                      }
                    },
                    "required": [
                      "enabled",
                      "slots"
                    ],
                    "title": "DayScheduleDto"
                  }
                },
                "required": [
                  "mon",
                  "tue",
                  "wed",
                  "thu",
                  "fri",
                  "sat",
                  "sun"
                ],
                "title": "WeeklyScheduleDto"
              },
              "continueConversations": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean",
                    "example": true
                  },
                  "inactivityTimeout": {
                    "type": "object",
                    "properties": {
                      "value": {
                        "type": "number",
                        "example": 15,
                        "minimum": 1,
                        "maximum": 1440,
                        "description": "5–1440 for minutes, 1–24 for hours (5 min – 24 h). Exact bound depends on `unit`."
                      },
                      "unit": {
                        "type": "string",
                        "enum": [
                          "minutes",
                          "hours"
                        ]
                      }
                    },
                    "required": [
                      "value",
                      "unit"
                    ],
                    "title": "InactivityTimeoutDto"
                  }
                },
                "required": [
                  "enabled",
                  "inactivityTimeout"
                ],
                "title": "ContinueConversationsDto"
              },
              "offHoursAutoReply": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean",
                    "example": false
                  },
                  "message": {
                    "type": "string",
                    "example": "Thanks for reaching out! We're currently outside of business hours."
                  },
                  "sendNotification": {
                    "type": "boolean",
                    "example": false
                  },
                  "notificationConfig": {
                    "nullable": true,
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "emailNotification": {
                            "type": "object",
                            "properties": {
                              "enabled": {
                                "type": "boolean",
                                "example": false
                              },
                              "notifyAdmins": {
                                "type": "boolean",
                                "example": false
                              },
                              "notifyAllUsers": {
                                "type": "boolean",
                                "example": false
                              },
                              "notifyAssignedUser": {
                                "type": "boolean",
                                "example": false
                              },
                              "notifySpecificUsers": {
                                "type": "boolean",
                                "example": false
                              },
                              "specificUserIds": {
                                "example": [],
                                "maxItems": 1000,
                                "type": "array",
                                "items": {
                                  "type": "string"
                                }
                              },
                              "notifyCustomEmail": {
                                "type": "boolean",
                                "example": false
                              },
                              "customEmail": {
                                "type": "string",
                                "example": "",
                                "description": "Comma-separated emails. May be empty; a blank value simply yields no custom recipient."
                              }
                            },
                            "required": [
                              "notifyAdmins",
                              "notifyAllUsers",
                              "notifyAssignedUser",
                              "notifySpecificUsers",
                              "specificUserIds",
                              "notifyCustomEmail",
                              "customEmail"
                            ],
                            "title": "EmailNotificationRecipientsDto"
                          },
                          "contactTags": {
                            "example": [],
                            "maxItems": 500,
                            "type": "array",
                            "items": {
                              "type": "string"
                            }
                          }
                        },
                        "required": [
                          "emailNotification",
                          "contactTags"
                        ],
                        "title": "OffHoursNotificationConfigDto"
                      }
                    ]
                  }
                },
                "required": [
                  "enabled",
                  "message"
                ],
                "title": "OffHoursAutoReplyDto"
              },
              "followUp": {
                "type": "object",
                "properties": {
                  "enabled": {
                    "type": "boolean",
                    "example": false
                  },
                  "message": {
                    "type": "string",
                    "example": "Hi {{contact.name}}, we're here now and happy to help."
                  }
                },
                "required": [
                  "enabled",
                  "message"
                ],
                "title": "WorkingHoursFollowUpMessageDto"
              },
              "employeeId": {
                "type": "string",
                "example": "wK36brxPYCOikC85FkbA",
                "description": "AI employee id this config belongs to."
              },
              "createdAt": {
                "type": "string",
                "format": "date-time",
                "description": "ISO-8601 creation time."
              },
              "updatedAt": {
                "type": "string",
                "format": "date-time",
                "description": "ISO-8601 last-update time."
              }
            },
            "required": [
              "enabled",
              "channels",
              "timezoneMode",
              "schedule",
              "continueConversations",
              "offHoursAutoReply",
              "followUp",
              "employeeId"
            ],
            "title": "WorkingHoursConfigPayloadDto"
          },
          "success": {
            "type": "boolean",
            "example": true
          }
        },
        "required": [
          "data",
          "success"
        ],
        "title": "WorkingHoursConfigResponseDto"
      },
      "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"
      },
      "WorkingHoursNotFoundDto": {
        "type": "object",
        "properties": {
          "statusCode": {
            "type": "number",
            "example": 404,
            "description": "HTTP status code"
          },
          "message": {
            "type": "string",
            "example": "Working hours configuration not found",
            "description": "Error message"
          },
          "error": {
            "type": "string",
            "example": "Not Found",
            "description": "Error type"
          }
        },
        "required": [
          "statusCode",
          "message",
          "error"
        ],
        "title": "WorkingHoursNotFoundDto"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/conversation-ai/agents/<agentId>/working-hours' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: 2023-02-21'
```

**Node.js**

```javascript
const options = {
  method: 'GET',
  headers: {
    Authorization: 'Bearer <TOKEN>',
    Version: '2023-02-21'
  }
};

try {
  const response = await fetch('https://services.leadconnectorhq.com/conversation-ai/agents/<agentId>/working-hours', options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

**Python**

```python
import requests

url = "https://services.leadconnectorhq.com/conversation-ai/agents/{agentId}/working-hours"

headers = {
    "Authorization": "Bearer <TOKEN>",
    "Version": "2023-02-21"
}

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

**PHP**

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

curl_setopt_array($curl, [
  CURLOPT_URL => 'https://services.leadconnectorhq.com/conversation-ai/agents/<agentId>/working-hours',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: 2023-02-21',
  ],
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/conversation-ai/agents/<agentId>/working-hours")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "2023-02-21")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/conversation-ai/agents/<agentId>/working-hours"
  req, _ := http.NewRequest("GET", url, nil)
  req.Header.Add("Authorization", "Bearer <TOKEN>")
  req.Header.Add("Version", "2023-02-21")

  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/conversation-ai/agents/<agentId>/working-hours")

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

request = Net::HTTP::Get.new(url)
request["Authorization"] = "Bearer <TOKEN>"
request["Version"] = "2023-02-21"

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

**PowerShell**

```powershell
$headers = @{
  "Authorization" = "Bearer <TOKEN>"
  "Version" = "2023-02-21"
}

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/conversation-ai/agents/<agentId>/working-hours' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
