# Get Appointment

GET https://services.leadconnectorhq.com/calendars/events/appointments/{eventId}

Get appointment by ID

## Authentication

Send `Authorization: Bearer <token>` using:

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

## 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": "LeadConnector API",
    "version": "v3"
  },
  "servers": [
    {
      "url": "https://services.leadconnectorhq.com"
    }
  ],
  "paths": {
    "/calendars/events/appointments/{eventId}": {
      "get": {
        "summary": "Get Appointment",
        "operationId": "getAppointment",
        "description": "Get appointment 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"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetCalendarEventSuccessfulResponseDTO"
                }
              }
            }
          },
          "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.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": {
      "GetCalendarEventSuccessfulResponseDTO": {
        "type": "object",
        "properties": {
          "event": {
            "description": "Calendar event object",
            "example": {
              "id": "ocQHyuzHvysMo5N5VsXc",
              "calendarId": "CVokAlI8fgw4WjWoC3IS",
              "title": "Appointment with John"
            },
            "allOf": [
              {
                "type": "object",
                "properties": {
                  "id": {
                    "type": "string",
                    "description": "Event Id or Instance id for a recurring event",
                    "examples": [
                      "ocQHyuzHvysMo5N5VsXc",
                      "ocQHyuzHvysMo5N5VsXc_1729821600000_1800"
                    ],
                    "example": "ocQHyuzHvysMo5N5VsXc"
                  },
                  "address": {
                    "type": "string",
                    "description": "Calendar Event address",
                    "example": "https://meet.google.com/yqp-gogr-wve"
                  },
                  "title": {
                    "type": "string",
                    "description": "Calendar Event title",
                    "example": "Appointment with Dev team"
                  },
                  "calendarId": {
                    "type": "string",
                    "description": "Calendar ID",
                    "example": "BqTwX8QFwXzpegMve9EQ"
                  },
                  "locationId": {
                    "type": "string",
                    "description": "Location ID",
                    "example": "0007BWpSzSwfiuSl0tR2"
                  },
                  "contactId": {
                    "type": "string",
                    "description": "Contact ID",
                    "example": "9NkT25Vor1v4aQatFsv2"
                  },
                  "groupId": {
                    "type": "string",
                    "description": "Group ID",
                    "example": "9NkT25Vor1v4aQatFsv2"
                  },
                  "appointmentStatus": {
                    "type": "string",
                    "description": "Appointment Status",
                    "example": "confirmed"
                  },
                  "assignedUserId": {
                    "type": "string",
                    "description": "AssignedUser - the primary owner of an appointment",
                    "example": "YlWd2wuCAZQzh2cH1fVZ"
                  },
                  "users": {
                    "description": "Users - the secondary owners of an appointment.",
                    "example": [
                      "YlWd2wuCAZQzh2cH1fVZ",
                      "9NkT25Vor1v4aQatFsv2"
                    ],
                    "type": "array",
                    "items": {
                      "type": "string"
                    }
                  },
                  "notes": {
                    "type": "string",
                    "description": "Notes",
                    "example": "Some dummy note"
                  },
                  "description": {
                    "type": "string",
                    "description": "Description",
                    "example": "Some dummy description"
                  },
                  "isRecurring": {
                    "type": "boolean",
                    "description": "true if the event is recurring otherwise false",
                    "example": "true"
                  },
                  "rrule": {
                    "type": "string",
                    "description": "RRULE as per the iCalendar (RFC 5545) specification for recurring events. DTSTART is not required, instance ids are calculated on the basis of startTime of the event.",
                    "examples": [
                      "RRULE:FREQ=DAILY;INTERVAL=1;COUNT=5",
                      "RRULE:FREQ=DAILY;INTERVAL=1;UNTIL=20210623T043000Z\nEXDATE:20211105T040000Z,20211105T040000Z"
                    ],
                    "example": "RRULE:FREQ=DAILY;INTERVAL=1;COUNT=5"
                  },
                  "deleted": {
                    "type": "boolean",
                    "description": "Tells if a calendar event has been deleted",
                    "example": false
                  },
                  "startTime": {
                    "type": "object",
                    "description": "Start Time",
                    "example": "2023-09-25T16:00:00+05:30"
                  },
                  "endTime": {
                    "type": "object",
                    "description": "End Time",
                    "example": "2023-09-25T16:00:00+05:30"
                  },
                  "dateAdded": {
                    "type": "object",
                    "description": "Date Added",
                    "example": "2023-09-25T16:00:00+05:30"
                  },
                  "dateUpdated": {
                    "type": "object",
                    "description": "Date Updated",
                    "example": "2023-09-25T16:00:00+05:30"
                  },
                  "assignedResources": {
                    "description": "Ids of associated resources rooms and/or equipments",
                    "type": "array",
                    "items": {
                      "type": "string"
                    },
                    "example": [
                      "YlWd2wuCAZQzh2cH1fVZ",
                      "BqTwX5hA2NLRadBMgR6M"
                    ]
                  },
                  "createdBy": {
                    "description": "Appointment booked by metadata",
                    "allOf": [
                      {
                        "type": "object",
                        "properties": {
                          "userId": {
                            "type": "string",
                            "description": "The ID of the user who created or updated the appointment",
                            "example": "7NkT25Vor1v4aQatFsv2"
                          },
                          "source": {
                            "type": "string",
                            "description": "The source of the appointment",
                            "example": "public_api"
                          }
                        },
                        "required": [
                          "source"
                        ],
                        "title": "CreatedOrUpdatedBy"
                      }
                    ],
                    "example": {
                      "userId": "YlWd2wuCAZQzh2cH1fVZ",
                      "source": "public_api"
                    }
                  },
                  "masterEventId": {
                    "type": "string",
                    "description": "Master event id for a recurring instance",
                    "example": "ocWd2wuBGAQzh2cH1fSZ"
                  },
                  "rescheduledAt": {
                    "type": "string",
                    "description": "Timestamp of when the appointment was last rescheduled. Only present for rescheduled appointments.",
                    "format": "date-time",
                    "example": "2023-09-25T16:00:00+05:30"
                  }
                },
                "required": [
                  "id",
                  "title",
                  "calendarId",
                  "locationId",
                  "contactId",
                  "groupId",
                  "appointmentStatus",
                  "assignedUserId",
                  "users",
                  "startTime",
                  "endTime",
                  "dateAdded",
                  "dateUpdated"
                ],
                "title": "CalendarEventDTO"
              }
            ]
          }
        },
        "title": "GetCalendarEventSuccessfulResponseDTO"
      },
      "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"
      }
    }
  }
}
```

## Code Examples

**cURL**

```bash
curl -L -X GET 'https://services.leadconnectorhq.com/calendars/events/appointments/<eventId>' \
  -H 'Authorization: Bearer <TOKEN>' \
  -H 'Version: v3'
```

**Node.js**

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

try {
  const response = await fetch('https://services.leadconnectorhq.com/calendars/events/appointments/<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/appointments/{eventId}"

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

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/calendars/events/appointments/<eventId>',
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_CUSTOMREQUEST => 'GET',
  CURLOPT_HTTPHEADER => [
    'Authorization: Bearer <TOKEN>',
    'Version: v3',
  ],
]);

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

**Java**

```java
HttpResponse<String> response = Unirest
  .get("https://services.leadconnectorhq.com/calendars/events/appointments/<eventId>")
  .header("Authorization", "Bearer <TOKEN>")
  .header("Version", "v3")
  .asString();
```

**Go**

```go
package main

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

func main() {
  url := "https://services.leadconnectorhq.com/calendars/events/appointments/<eventId>"
  req, _ := http.NewRequest("GET", url, nil)
  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/appointments/<eventId>")

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

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

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

**PowerShell**

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

$response = Invoke-RestMethod -Uri 'https://services.leadconnectorhq.com/calendars/events/appointments/<eventId>' -Method 'GET' -Headers $headers
$response | ConvertTo-Json
```
