Source: https://leadping.ai/docs/api-reference/appointments/gets-occupied-appointment-times-for-a-leads-selected-assignee

# Gets occupied appointment times for a lead's selected assignee.

## Endpoint

```http
GET https://api.leadping.ai/appointments/booked-times
```

## Request examples

### cURL

```bash
curl --request GET \
  --url https://api.leadping.ai/appointments/booked-times \
  --header 'Authorization: Bearer <token>'
```

### Python

```python
import requests

url = "https://api.leadping.ai/appointments/booked-times"

headers = {"Authorization": "Bearer <token>"}

response = requests.get(url, headers=headers)

print(response.text)
```

### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://api.leadping.ai/appointments/booked-times");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("Authorization", "Bearer <token>");
var response = await client.GetAsync(request);

Console.WriteLine("{0}", response.Content);
```

### Java

```java
HttpResponse<String> response = Unirest.get("https://api.leadping.ai/appointments/booked-times")
  .header("Authorization", "Bearer <token>")
  .asString();
```

### JavaScript

```javascript
const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};

fetch('https://api.leadping.ai/appointments/booked-times', options)
  .then(res => res.json())
  .then(res => console.log(res))
  .catch(err => console.error(err));
```

### Go

```go
package main

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

func main() {

	url := "https://api.leadping.ai/appointments/booked-times"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("Authorization", "Bearer <token>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(string(body))

}
```

### PHP

```php
<?php

$curl = curl_init();

curl_setopt_array($curl, [
  CURLOPT_URL => "https://api.leadping.ai/appointments/booked-times",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "GET",
  CURLOPT_HTTPHEADER => [
    "Authorization: Bearer <token>"
  ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
  echo "cURL Error #:" . $err;
} else {
  echo $response;
}
```

## Authorizations

### `Authorization`

- **Type:** `string`
- **Location:** Header
- **Required:** Yes

Authorization header using the Bearer scheme. Accepted values are Leadping user JWT access tokens and WorkOS organization API keys beginning with `sk_`.

## Query parameters

### `leadId`

- **Type:** `string`

### `ownerId`

- **Type:** `string`

### `appointmentId`

- **Type:** `string`

## Responses

### `200 OK`

Returns an object.

### `401 Unauthorized`

Authentication credentials are missing or invalid.

Response content type: `application/problem+json`

```json
{
  "type": "about:blank",
  "title": "Unauthorized",
  "status": 401,
  "detail": "The request could not be completed."
}
```

The response may include the following fields:

- `type`: URI reference that identifies the problem type. `null` or `string`.
- `title`: Short, human-readable summary of the problem. `null` or `string`.
- `status`: HTTP status code returned for the problem. `null` or `integer<int32>`.
- `detail`: Human-readable explanation specific to this occurrence of the problem. `null` or `string`.
- `instance`: URI reference that identifies this specific occurrence of the problem. `null` or `string`.
- `errors`: Validation errors keyed by the JSON request field name. Present for request validation failures. An object whose values are arrays of strings.
- `traceId`: Request trace identifier used to correlate this problem with Leadping diagnostics.

Response header:

- `WWW-Authenticate`: Bearer authentication challenge returned when credentials are missing or invalid.

### `403 Forbidden`

The authenticated user or organization does not have permission to perform this operation.

Response content type: `application/problem+json`

```json
{
  "type": "about:blank",
  "title": "Forbidden",
  "status": 403,
  "detail": "The request could not be completed."
}
```

The response may include the following fields:

- `type`: URI reference that identifies the problem type. `null` or `string`.
- `title`: Short, human-readable summary of the problem. `null` or `string`.
- `status`: HTTP status code returned for the problem. `null` or `integer<int32>`.
- `detail`: Human-readable explanation specific to this occurrence of the problem. `null` or `string`.
- `instance`: URI reference that identifies this specific occurrence of the problem. `null` or `string`.
- `errors`: Validation errors keyed by the JSON request field name. Present for request validation failures. An object whose values are arrays of strings.
- `traceId`: Request trace identifier used to correlate this problem with Leadping diagnostics.

### `429 Too Many Requests`

The API rate limit for this account or client has been exceeded.

Response content type: `application/problem+json`

```json
{
  "type": "about:blank",
  "title": "Too Many Requests",
  "status": 429,
  "detail": "The request could not be completed."
}
```

The response may include the following fields:

- `type`: URI reference that identifies the problem type. `null` or `string`.
- `title`: Short, human-readable summary of the problem. `null` or `string`.
- `status`: HTTP status code returned for the problem. `null` or `integer<int32>`.
- `detail`: Human-readable explanation specific to this occurrence of the problem. `null` or `string`.
- `instance`: URI reference that identifies this specific occurrence of the problem. `null` or `string`.
- `errors`: Validation errors keyed by the JSON request field name. Present for request validation failures. An object whose values are arrays of strings.
- `traceId`: Request trace identifier used to correlate this problem with Leadping diagnostics.

Response header:

- `Retry-After`: Number of seconds to wait before retrying the request. Integer greater than or equal to `0`.
