# Accept or decline an invitation

Responds to a workspace invitation addressed to the signed-in user, accepting it with the invited role or declining it.

Request: POST /api/v1/answer-invite

> Part of the SQRL documentation, section "API Reference".
> Rendered page: https://docs.sqrl.tech/api/answer-invite

The invitation is identified by the workspace it is for, not by the `InviteUID`
that [`GET /api/v1/get-invites-pending`](/api/get-invites-pending) returns, so
pass the `Workspace.uid` from that list as `workspace_uid`. Send `accept: true`
to accept and take up the invited role, or `accept: false` to decline. Either way
the invitation stops being outstanding.

```bash tab="cURL"
curl -X POST "$SQRL_API/api/v1/answer-invite" \
  -H "authorization: Bearer $SQRL_TOKEN" \
  -H "content-type: application/json" \
  -d '{ "workspace_uid": 342, "accept": true }'
```

```ts tab="TypeScript"
const res = await fetch(`${process.env.SQRL_API}/api/v1/answer-invite`, {
  method: "POST",
  headers: {
    authorization: `Bearer ${process.env.SQRL_TOKEN}`,
    "content-type": "application/json",
  },
  body: JSON.stringify({ workspace_uid: 342, accept: true }),
});
const { Success } = await res.json();
```

```rust tab="Rust"
let res = client
    .post(format!("{}/api/v1/answer-invite", api_base))
    .bearer_auth(&token)
    .json(&serde_json::json!({ "workspace_uid": 342, "accept": true }))
    .send()
    .await?;
```

{`{
  "Success": true
}`}
