Source: https://leadping.ai/docs/api-reference/invitations/decline-with-token

# Decline with token

## Invitations

**POST** `/invitations/decline`

### Request body

Content types:

- `application/json`
- `text/json`
- `application/*+json`

Supplies the secret invitation token from the recipient’s email link.

| Field | Type |
|---|---|
| `token` | string |

### Examples

#### cURL

```bash
curl --request POST \
  --url https://api.leadping.ai/invitations/decline \
  --header 'Content-Type: application/json' \
  --data '{
  "token": "<string>"
}'
```

#### Python

```python
import requests

url = "https://api.leadping.ai/invitations/decline"

payload = { "token": "<string>" }
headers = {"Content-Type": "application/json"}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
```

#### C#

```csharp
using RestSharp;


var options = new RestClientOptions("https://api.leadping.ai/invitations/decline");
var client = new RestClient(options);
var request = new RestRequest("");
request.AddJsonBody("{\n  \"token\": \"<string>\"\n}", false);
var response = await client.PostAsync(request);

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

#### Java

```java
HttpResponse<String> response = Unirest.post("https://api.leadping.ai/invitations/decline")
  .header("Content-Type", "application/json")
  .body("{\n  \"token\": \"<string>\"\n}")
  .asString();
```

#### JavaScript

```javascript
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: JSON.stringify({token: '<string>'})
};

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

#### Go

```go
package main

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

func main() {

	url := "https://api.leadping.ai/invitations/decline"

	payload := strings.NewReader("{\n  \"token\": \"<string>\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Content-Type", "application/json")

	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/invitations/decline",
  CURLOPT_RETURNTRANSFER => true,
  CURLOPT_ENCODING => "",
  CURLOPT_MAXREDIRS => 10,
  CURLOPT_TIMEOUT => 30,
  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
  CURLOPT_CUSTOMREQUEST => "POST",
  CURLOPT_POSTFIELDS => json_encode([
    'token' => '<string>'
  ]),
  CURLOPT_HTTPHEADER => [
    "Content-Type: application/json"
  ],
]);

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

curl_close($curl);

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

## Response

### `200` — OK

### `429` — Too Many Requests

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

#### Headers

| Header | Description | Type |
|---|---|---|
| `Retry-After` | Number of seconds to wait before retrying the request. | integer (`int32`), minimum `0` |

#### Response body

Content type: `application/problem+json`

Standard problem-details response containing machine-readable and human-readable information about an HTTP API error.

| Field | Type | Description |
|---|---|---|
| `type` | null \| string | URI reference that identifies the problem type. |
| `title` | null \| string | Short, human-readable summary of the problem. |
| `status` | null \| integer (`int32`) | HTTP status code returned for the problem. |
| `detail` | null \| string | Human-readable explanation specific to this occurrence of the problem. |
| `instance` | null \| string | URI reference that identifies this specific occurrence of the problem. |
| `errors` | object | Validation errors keyed by the JSON request field name. Present for request validation failures. |
| `traceId` | string | Request trace identifier used to correlate this problem with Leadping diagnostics. |

Example:

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

[Previous: Generate a WebRTC login token](https://leadping.ai/docs/api-reference/telephony/generate-a-webrtc-login-token) · [Next: Get](https://leadping.ai/docs/api-reference/invitations/get)
