> ## Documentation Index
> Fetch the complete documentation index at: https://docs.sublay.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Decline Invite

> Decline an invitation — identity-matched and verification-gated

Declines an invitation. Identity-matched (the caller must be the invite's target) **and** verification-gated — a **verified email is required**, exactly as it is to [accept](/v8/api-reference/workspaces/invitations/accept-invite). Without that gate, someone who signed up with another person's address and never verified it could burn the real target's invite by moving it to the terminal `declined` state. This is **not** a key-bypass gate: a service or master key acting as a named `actingUserId` still requires *that* user to be verified.

Marks the invite `declined` and fires `workspace.invite.declined`.

## Path Parameters

<ParamField path="inviteId" type="string" required>
  The invitation UUID.
</ParamField>

## Body Parameters

<ParamField body="actingUserId" type="string" required>
  Service/master keys only — the declining user (must be the invite's target). **Required for a key:** a decline is an act by the invitee, so there is no unbounded path — a key that names nobody is refused with `400 workspace/missing-user-id`.

  A plain user token omits it — the actor is the token's own user. The field is **not** ignored for such a token: sending your *own* user id is a harmless no-op, but sending **anyone else's** is a `403 workspace/unauthorized`. See [Acting on behalf of a user](/v8/sdk/workspaces/overview#acting-on-behalf-of-a-user).
</ParamField>

## Response

```json theme={null}
{ "success": true }
```

## Error Responses

<AccordionGroup>
  <Accordion title="Email Not Verified — 403">
    ```json theme={null}
    { "error": "A verified email is required to decline an invitation.", "code": "workspace/email-not-verified" }
    ```
  </Accordion>

  <Accordion title="Not the Target — 404">
    A caller who is not the invitation's target receives the **same** `404` as a
    non-existent invitation.

    ```json theme={null}
    { "error": "Invitation not found.", "code": "workspace/invite-not-found" }
    ```
  </Accordion>

  <Accordion title="Invite Terminal — 409">
    ```json theme={null}
    { "error": "This invitation is no longer pending.", "code": "workspace/invite-terminal" }
    ```
  </Accordion>

  <Accordion title="Acting User Not Found — 404">
    ```json theme={null}
    { "error": "Acting user not found.", "code": "workspace/invalid-target" }
    ```

    The `actingUserId` a key named does not exist in this project. Naming is not authentication — the id is only looked up here.
  </Accordion>

  <Accordion title="Missing Acting User — 400">
    ```json theme={null}
    { "error": "Missing user ID", "code": "workspace/missing-user-id" }
    ```

    A service/master key called this route without naming an `actingUserId`. A decline is an act by the invitee; there is nobody to attribute it to.
  </Accordion>

  <Accordion title="Acted as Another User — 403">
    ```json theme={null}
    { "error": "Unauthorized", "code": "workspace/unauthorized" }
    ```

    A plain user token sent an `actingUserId` naming a **different** user. Only a service/master key may act as someone else.
  </Accordion>

  <Accordion title="Invalid Path Parameter — 400">
    ```json theme={null}
    { "error": "Invalid invitation id: expected a UUID.", "code": "workspace/invalid-params" }
    ```

    Every path id on the workspaces bundle is checked for UUID shape before the route runs, so a malformed one is a plain `400` rather than a `500` from the database.
  </Accordion>
</AccordionGroup>

See also: [useDeclineWorkspaceInvite](/v8/hooks/workspaces/use-decline-workspace-invite)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.