# List ownership change requests for a channel

`GET /api/v1/video-channels/{channelHandle}/ownership`

List all ownership change requests for a specific channel. The authenticated user must be able to manage the channel.

Authentication (security requirement alternatives):

```json
[
  {
    "OAuth2": []
  }
]
```

- OAuth2: oauth2. Authenticating via OAuth requires the following steps:
- Have an activated account
- [Generate] an access token for that account at `/api/v1/users/token`.
- Make requests with the *Authorization: Bearer <token\>* header
- Profit, depending on the role assigned to the account

Note that the __access token is valid for 1 day__ and is given
along with a __refresh token valid for 2 weeks__.

[Generate]: https://docs.joinpeertube.org/api/rest-getting-started


Parameters:

- `channelHandle` (path, string, required) - The video channel handle
  Type: string
  
  Example:
  
  ```json
  "my_username | my_username@example.com"
  ```

- `state` (query, ChangeOwnershipState, optional) - Filter by ownership change state
  Type: ChangeOwnershipState
  
  The ownership change state (Pending = `1`, Rejected = `2`, Accepted = `3`)
  
  Schema: [ChangeOwnershipState](https://sourcey-peertube.pages.dev/api-rest-reference/models/changeownershipstate.md)
  
  enum: [1,2,3]

- `start` (query, integer, optional) - Offset used to paginate results
  Type: integer
  
  minimum: 0

- `count` (query, integer, optional) - Number of items to return
  Type: integer
  
  default: 15
  
  minimum: 1
  
  maximum: 100

- `sort` (query, string, optional)
  Type: string
  
  enum: ["-createdAt","createdAt"]

Responses:

- 200: successful operation

Content type: application/json

Type: object

- `total` (optional)
  Type: integer
  
  Example:
  
  ```json
  1
  ```

- `data` (optional)
  Type: Array<ChangeOwnership>
  
  Items:
    Reference: [ChangeOwnership](https://sourcey-peertube.pages.dev/api-rest-reference/models/changeownership.md); Type: ChangeOwnership
    
    Representation of a ownership change

- 400: invalid parameters

- 403: cannot manage the channel

- 404: channel not found

## Examples

### cURL

```bash
curl -X GET 'https://peertube2.cpy.re/api/v1/video-channels/my_username%20%7C%20my_username%40example.com/ownership?count=15' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('https://peertube2.cpy.re/api/v1/video-channels/my_username%20%7C%20my_username%40example.com/ownership?count=15', {
  method: 'GET',
  headers: {
    'Authorization': 'Bearer YOUR_TOKEN',
  },
});

const data = await response.text();
```

### Python

```python
import requests

response = requests.get(
    'https://peertube2.cpy.re/api/v1/video-channels/my_username%20%7C%20my_username%40example.com/ownership?count=15',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```
