# Endpoints

## Return a Tana Paste or JSON representation of your calendar

<mark style="color:blue;">`GET`</mark> `http://localhost:PORT/events.format`

The default endpoint supports both JSON and Tana Paste output. Replace 'format' with either tana or json to get the desired results. Use the parameters to customize the output.

#### Path Parameters

| Name                                     | Type   | Description         |
| ---------------------------------------- | ------ | ------------------- |
| format<mark style="color:red;">\*</mark> | String | Either tana or json |

#### Query Parameters

| Name               | Type    | Description                                                                                                                                                                         |
| ------------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| filterField        | String  | Filters specific fields from the output (comma separated)                                                                                                                           |
| filterTitle        | String  | Filters events with these titles (comma separated)                                                                                                                                  |
| filterAttendee     | String  | Filters attendees with these names (comma separated)                                                                                                                                |
| filterStatus       | String  | <p>Filters events with these statuses (comma separated)<br><br>Options: Canceled, Confirmed, None, Tentative, Unknown</p>                                                           |
| filterCalendar     | String  | Filters events from these calendars (comma separated)                                                                                                                               |
| tag                | String  | Customize the tag (default: meeting)                                                                                                                                                |
| date               | String  | Specify a specific date (default is today). Format: YYYY-MM-DDD                                                                                                                     |
| offset             | Integer | How many days to return events for (default is 1).                                                                                                                                  |
| truncate           | Bool    | Truncate the notes field to remove content from video calls                                                                                                                         |
| filterAvailability | String  | <p>Filters events with these availabilities (comma separated)<br><br>Options: Free, Busy, Not Supported, Tentative, Unavailable, Unknown</p>                                        |
| selectCalendar     | String  | Select events from these calendars (comma separated)                                                                                                                                |
| filterAllDay       | Bool    | <p>Filters events that are all day or not all day<br><br>Options: true, false</p>                                                                                                   |
| \*-tag             | String  | <p>One or more url-encoded regexes (split by \_\_) that when successfully matched against the event title, use the specified tag.<br><br>i.e 1-1-tag=.%2A%20-%20.%2A\_\_Sync%24</p> |
| timingField        | String  | Customize the name of the timing field (default: Timing)                                                                                                                            |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token |

{% tabs %}
{% tab title="200: OK Default JSON/Tana Paste response" %}

{% endtab %}

{% tab title="401: Unauthorized Incorrect Bearer token in the authorization header" %}

{% endtab %}
{% endtabs %}

## Fill a custom template with your calendar information

<mark style="color:green;">`POST`</mark> `http://localhost:PORT/events`

Post an event template and the API will return it filled for each event. You can use the variables named under 'Body' in your template.

Example:

&#x20;\- {Title} ({Start} - {End})

#### Query Parameters

| Name               | Type    | Description                                                                                                                                                                         |
| ------------------ | ------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| filterTitle        | String  | Filters events with these titles (comma separated)                                                                                                                                  |
| filterAttendee     | String  | Filters attendees with these names (comma separated)                                                                                                                                |
| filterStatus       | String  | <p>Filters events with these statuses (comma separated)<br><br>Options: Canceled, Confirmed, None, Tentative, Unknown</p>                                                           |
| filterCalendar     | String  | Filters events from these calendars (comma separated)                                                                                                                               |
| tag                | String  | Customize the tag (default: meeting)                                                                                                                                                |
| date               | String  | Specify a specific date (default is today). Format: YYYY-MM-DDD                                                                                                                     |
| offset             | Integer | How many days to return events for (default is 1).                                                                                                                                  |
| truncate           | Bool    | Truncate the notes field to remove content from video calls                                                                                                                         |
| filterAvailability | String  | <p>Filters events with these availabilities (comma separated)<br><br>Options: Free, Busy, Not Supported, Tentative, Unavailable, Unknown</p>                                        |
| selectCalendar     | String  | Select events from these calendars (comma separated)                                                                                                                                |
| filterAllDay       | Bool    | <p>Filters events that are all day or not all day<br><br>Options: true, false</p>                                                                                                   |
| \*-tag             | String  | <p>One or more url-encoded regexes (split by \_\_) that when successfully matched against the event title, use the specified tag.<br><br>i.e 1-1-tag=.%2A%20-%20.%2A\_\_Sync%24</p> |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token |

#### Request Body

| Name       | Type   | Description                                                                    |
| ---------- | ------ | ------------------------------------------------------------------------------ |
| {Title}    | String | Title of the event                                                             |
| {Location} | String | Location of the event                                                          |
| {Status}   | String | Status of the event                                                            |
| {Attendee} | String | Attendee of the event (the line will be multiplied per attendee)               |
| {Start}    | String | Start datetime of the event                                                    |
| {End}      | String | End datetime of the event                                                      |
| {Notes}    | String | The notes of the event                                                         |
| {Tag}      | String | The matched tag from the \*-tag attributes in the query, defaults to 'meeting' |

{% tabs %}
{% tab title="200: OK The filled template per event" %}

{% endtab %}

{% tab title="401: Unauthorized Incorrect Bearer token in the authorization header" %}

{% endtab %}
{% endtabs %}

## Create events

<mark style="color:green;">`POST`</mark> `http://localhost:PORT/events/create`

Create event in the default (or specfied calendar) from the posted JSON body.

Example:

`{ "title": "${name}", "startDate": "${Timing.start}", "endDate": "${Timing.end}", "notes": "${Notes}"}`

#### Query Parameters

| Name     | Type   | Description                              |
| -------- | ------ | ---------------------------------------- |
| calendar | String | Name of the calendar to add the event to |

#### Headers

| Name                                            | Type   | Description  |
| ----------------------------------------------- | ------ | ------------ |
| Authorization<mark style="color:red;">\*</mark> | String | Bearer token |

{% tabs %}
{% tab title="200: OK Event created" %}

{% endtab %}

{% tab title="400: Bad Request Error with creating the event" %}

{% endtab %}
{% endtabs %}
