# Send RSVP

> **POST** `https://api.us.nylas.com/v3/grants/{grant_id}/events/{event_id}/send-rsvp`

Source: https://developer.nylas.com/docs/reference/api/events/send-rsvp/

(Not supported for iCloud) Sends a response to an event that you're added to as a participant. You
can't directly update events as a participant.

For most events on EWS, if you decline the event by sending a "no" RSVP response, it's removed from
your calendar. If an EWS administrator disabled the option to remove declined events from calendars,
the event remains on the calendar with the "no" RSVP status.

Due to a provider limitation, Microsoft Graph might not update the event status properly.

Google allows the meeting organizer to reply "yes", "maybe", and "no" to event invitations. However,
other providers do not allow meeting organizers to reply to their own event.

Nylas sends calendar RSVPs to the event organizer as email updates.
This can duplicate the RSVP email sent by the calendar provider.
If you want to stop Nylas from sending the RSVP email, 
you can set the `skip_nylas_email` field to `true` in the query parameters.

If your application does not implement the
[scopes that allow you to send messages](/docs/dev-guide/scopes/#email-api-scopes), Nylas updates
the RSVP for the event and returns a `200` with an error message. Event participants on the same provider
will see the update, but participants on other providers will not.

**Authentication:** NYLAS_API_KEY, ACCESS_TOKEN

## Parameters

### Query parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `calendar_id` | string | Yes | Filter for the specified calendar ID.  (Not supported for iCloud) You can use `primary` to query the user's primary calendar. |
| `skip_nylas_email` | boolean | No | When `true`, Nylas does not send the RSVP email to the event organizer. |

### Path parameters

| Name | Type | Required | Description |
|------|------|----------|-------------|
| `grant_id` | string | Yes | ID of the grant to access. Use `/me/` to refer to the grant associated with an access token. |
| `event_id` | string | Yes | ID of the event to access. Nylas recommends you URL-encode this field, or you might receive a [`404` error](/docs/api/errors/400-response/) if the ID contains special characters (for example, `#`). |

## Request body

Content-Type: application/json

- `status` (string) - A participant's RSVP status for the event.

## Responses

### 200 - Send-RSVP Response

- `request_id` (string) - The request ID.
- `data` (object)
  - `send_ics_error` (object) - If an error occurs while sending an updated ICS file to the organizer of an event,
Nylas returns an error message in this field. The event is still updated, but the
ICS file is _not_ sent to the organizer.
    - `type` (string) - The type of error that occurred.
    - `message` (string) - A human-readable message with details about the error.

### 400 - Bad Request

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The error from the provider.

### 401 - Unauthorized

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.
  - `provider_error` (object) - The error from the provider.

### 429 - Rate Limit

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.

### 504 - Provider Failure

- `request_id` (string) - The request ID.
- `error` (object) - The response error object.
  - `type` (string) - The error type.
  - `message` (string) - The error message.

## Code samples

### cURL

```bash
curl --compressed --request POST \
  --url 'https://api.us.nylas.com/v3/grants/<NYLAS_GRANT_ID>/events/<EVENT_ID>/send-rsvp?calendar_id=<CALENDAR_ID>' \
  --header 'Accept: application/json' \
  --header 'Authorization: Bearer <NYLAS_API_KEY>' \
  --header 'Content-Type: application/json' \
  --data '{
    "status": "yes"
  }'
```

### Node.js SDK

```javascript
import Nylas from "nylas";

const nylas = new Nylas({
  apiKey: "<NYLAS_API_KEY>",
  apiUri: "<NYLAS_API_URI>",
});

async function sendEventRSVP() {
  try {
    const response = await nylas.events.sendRsvp({
      identifier: "<NYLAS_GRANT_ID>",
      eventId: "<EVENT_ID>",
      requestBody: {
        status: "yes",
      },
      queryParams: {
        calendarId: "<CALENDAR_ID>",
      },
    });

    console.log("Event RSVP:", response);
  } catch (error) {
    console.error("Error sending RSVP:", error);
  }
}

sendEventRSVP();

```

### Python SDK

```python
from nylas import Client

nylas = Client(
    "<NYLAS_API_KEY>",
    "<NYLAS_API_URI>"
)

response = nylas.events.send_rsvp(
    identifier="<NYLAS_GRANT_ID>",
    event_id="<EVENT_ID>",
    request_body={"status": "yes"},
    query_params={"calendar_id": "<CALENDAR_ID>"},
)

print(response)

```

### Ruby SDK

```ruby
require 'nylas'	

nylas = Nylas::Client.new(api_key: "<NYLAS_API_KEY>")

request_body = {
  status: "yes"
}

query_params = {
  calendar_id: "<CALENDAR_ID>"
}

event_rsvp = nylas.events.send_rsvp(
    identifier: "<NYLAS_GRANT_ID>",
    event_id: "<EVENT_ID>", 
    request_body: request_body,
    query_params: query_params)
    
puts event_rsvp
```

### Java SDK

```java
import com.nylas.NylasClient;
import com.nylas.models.*;

public class rsvp {
  public static void main(String[] args) throws NylasSdkTimeoutError, NylasApiError {
    NylasClient nylas = new NylasClient.Builder("<NYLAS_API_KEY>").build();
    SendRsvpRequest requestBody = new SendRsvpRequest(RsvpStatus.YES);
    SendRsvpQueryParams queryParams = new SendRsvpQueryParams("<CALENDAR_ID>");

    DeleteResponse rsvp = nylas.events().sendRsvp(
        "<NYLAS_GRANT_ID>",
        "<EVENT_ID>", 
        requestBody,
        queryParams);
        
    System.out.println(rsvp);
  }
}
```

### Kotlin SDK

```kotlin
import com.nylas.NylasClient
import com.nylas.models.RsvpStatus
import com.nylas.models.SendRsvpQueryParams
import com.nylas.models.SendRsvpRequest

fun main(args: Array<String>) {
  val nylas: NylasClient = NylasClient(apiKey = "<NYLAS_API_KEY>")
  val requestBody : SendRsvpRequest = SendRsvpRequest(RsvpStatus.YES)
  val queryParams : SendRsvpQueryParams = SendRsvpQueryParams("<CALENDAR_ID>")

  val rsvp = nylas.events().sendRsvp(
      "<NYLAS_GRANT_ID>",
      "<EVENT_ID>", 
      requestBody,
      queryParams)

  print(rsvp)
}
```
