# Invitations

Source: https://opvs.ai/docs/api/invitations

## `GET` /api/v1/brands/{brand_id}/invitations

**List Invitations**

List pending invitations for a brand. Brand admin only.

**Parameters**

- `brand_id` (path, integer, required)

```bash
curl -X GET 'https://app.opvs.ai/api/v1/brands/{brand_id}/invitations' \
  -H 'Authorization: Bearer <token>'
```

```python
import httpx

resp = httpx.get(
    "https://app.opvs.ai/api/v1/brands/{brand_id}/invitations",
    headers={"Authorization": "Bearer <token>"},
)
resp.raise_for_status()
print(resp.json())
```

```javascript
const resp = await fetch("https://app.opvs.ai/api/v1/brands/{brand_id}/invitations", {
  method: "GET",
  headers: { "Authorization": "Bearer <token>" }
});
const data = await resp.json();
console.log(data);
```

```go
package main

import (
	"net/http"
)

func main() {
	req, _ := http.NewRequest("GET", "https://app.opvs.ai/api/v1/brands/{brand_id}/invitations", nil)
	req.Header.Set("Authorization", "Bearer <token>")
	resp, _ := http.DefaultClient.Do(req)
	defer resp.Body.Close()
}
```

**Responses**

- `200` — Successful Response
- `422` — Validation Error

## `POST` /api/v1/brands/{brand_id}/invitations

**Send Invitation**

Send a team invitation. Brand admin only.

**Parameters**

- `brand_id` (path, integer, required)

**Request body**

```bash
curl -X POST 'https://app.opvs.ai/api/v1/brands/{brand_id}/invitations' \
  -H 'Authorization: Bearer <token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "email": "user@example.com"
}'
```

```python
import httpx

resp = httpx.post(
    "https://app.opvs.ai/api/v1/brands/{brand_id}/invitations",
    headers={"Authorization": "Bearer <token>", "Content-Type": "application/json"},
    json={"email": "user@example.com"},
)
resp.raise_for_status()
print(resp.json())
```

```javascript
const resp = await fetch("https://app.opvs.ai/api/v1/brands/{brand_id}/invitations", {
  method: "POST",
  headers: { "Authorization": "Bearer <token>", "Content-Type": "application/json" },
  body: JSON.stringify({"email": "user@example.com"})
});
const data = await resp.json();
console.log(data);
```

```go
package main

import (
	"net/http"
	"strings"
)

func main() {
	body := strings.NewReader(`{"email": "user@example.com"}`)
	req, _ := http.NewRequest("POST", "https://app.opvs.ai/api/v1/brands/{brand_id}/invitations", body)
	req.Header.Set("Authorization", "Bearer <token>")
	req.Header.Set("Content-Type", "application/json")
	resp, _ := http.DefaultClient.Do(req)
	defer resp.Body.Close()
}
```

**Responses**

- `201` — Successful Response
- `422` — Validation Error

## `DELETE` /api/v1/brands/{brand_id}/invitations/{invitation_id}

**Cancel Invitation**

Cancel a pending invitation. Brand admin only.

**Parameters**

- `brand_id` (path, integer, required)
- `invitation_id` (path, integer, required)

```bash
curl -X DELETE 'https://app.opvs.ai/api/v1/brands/{brand_id}/invitations/{invitation_id}' \
  -H 'Authorization: Bearer <token>'
```

```python
import httpx

resp = httpx.delete(
    "https://app.opvs.ai/api/v1/brands/{brand_id}/invitations/{invitation_id}",
    headers={"Authorization": "Bearer <token>"},
)
resp.raise_for_status()
print(resp.json())
```

```javascript
const resp = await fetch("https://app.opvs.ai/api/v1/brands/{brand_id}/invitations/{invitation_id}", {
  method: "DELETE",
  headers: { "Authorization": "Bearer <token>" }
});
const data = await resp.json();
console.log(data);
```

```go
package main

import (
	"net/http"
)

func main() {
	req, _ := http.NewRequest("DELETE", "https://app.opvs.ai/api/v1/brands/{brand_id}/invitations/{invitation_id}", nil)
	req.Header.Set("Authorization", "Bearer <token>")
	resp, _ := http.DefaultClient.Do(req)
	defer resp.Body.Close()
}
```

**Responses**

- `200` — Successful Response
- `422` — Validation Error

## `GET` /api/v1/invitations/validate/{token}

**Validate Invitation**

Validate an invitation token. Public endpoint (no auth required).

**Parameters**

- `token` (path, string, required)

```bash
curl -X GET 'https://app.opvs.ai/api/v1/invitations/validate/{token}' \
  -H 'Authorization: Bearer <token>'
```

```python
import httpx

resp = httpx.get(
    "https://app.opvs.ai/api/v1/invitations/validate/{token}",
    headers={"Authorization": "Bearer <token>"},
)
resp.raise_for_status()
print(resp.json())
```

```javascript
const resp = await fetch("https://app.opvs.ai/api/v1/invitations/validate/{token}", {
  method: "GET",
  headers: { "Authorization": "Bearer <token>" }
});
const data = await resp.json();
console.log(data);
```

```go
package main

import (
	"net/http"
)

func main() {
	req, _ := http.NewRequest("GET", "https://app.opvs.ai/api/v1/invitations/validate/{token}", nil)
	req.Header.Set("Authorization", "Bearer <token>")
	resp, _ := http.DefaultClient.Do(req)
	defer resp.Body.Close()
}
```

**Responses**

- `200` — Successful Response
- `422` — Validation Error

## List Invitations

`GET https://app.opvs.ai/api/v1/brands/{brand_id}/invitations`

List pending invitations for a brand. Brand admin only.

| Code | When | What to do |
| --- | --- | --- |
| 422 | Validation Error |  |

## Send Invitation

`POST https://app.opvs.ai/api/v1/brands/{brand_id}/invitations`

Send a team invitation. Brand admin only.

| Code | When | What to do |
| --- | --- | --- |
| 422 | Validation Error |  |

## Cancel Invitation

`DELETE https://app.opvs.ai/api/v1/brands/{brand_id}/invitations/{invitation_id}`

Cancel a pending invitation. Brand admin only.

| Code | When | What to do |
| --- | --- | --- |
| 422 | Validation Error |  |

## Validate Invitation

`GET https://app.opvs.ai/api/v1/invitations/validate/{token}`

Validate an invitation token. Public endpoint (no auth required).

| Code | When | What to do |
| --- | --- | --- |
| 422 | Validation Error |  |
