# Get subscription of my user

`GET /api/v1/users/me/subscriptions/{subscriptionHandle}`

Authentication (security requirement alternatives):

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

- 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
; scopes: user

Parameters:

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

Responses:

- 200: successful operation

Content type: application/json

Type: Actor & object

Schema: [VideoChannel](https://sourcey-peertube.pages.dev/api-rest-reference/models/videochannel.md)

allOf:
  Reference: [Actor](https://sourcey-peertube.pages.dev/api-rest-reference/models/actor.md); Type: Actor

  Type: object
  
  - `displayName` (optional)
    Type: string
    
    editable name of the channel, displayed in its representations
    
    minLength: 1
    
    maxLength: 120
    
    Example:
    
    ```json
    "Videos of Framasoft"
    ```
  
  - `description` (optional)
    Type: string; nullable
    
    minLength: 3
    
    maxLength: 1000
    
    Example:
    
    ```json
    "Videos made with <3 by Framasoft"
    ```
  
  - `support` (optional)
    Type: string; nullable
    
    text shown by default on all videos of this channel, to tell the audience how to support it
    
    minLength: 3
    
    maxLength: 1000
    
    Example:
    
    ```json
    "Please support our work on https://soutenir.framasoft.org/en/ <3"
    ```
  
  - `publicEmail` (optional)
    Type: string, email; nullable
    
    Public email visible in podcast RSS feeds
  
  - `isLocal` (optional)
    Type: boolean
  
  - `updatedAt` (optional)
    Type: string, date-time
  
  - `banners` (optional)
    Type: Array<ActorImage>
    
    Items:
      Reference: [ActorImage](https://sourcey-peertube.pages.dev/api-rest-reference/models/actorimage.md); Type: ActorImage
  
  - `ownerAccount` (optional)
    Reference: [Account](https://sourcey-peertube.pages.dev/api-rest-reference/models/account.md); Type: Actor & any
  
  - `videosCount` (optional)
    Type: integer
    
    only included when `withStats` is true
  
  - `viewsPerDay` (optional)
    Type: Array<object>
    
    only included when `withStats` is true. Chronologically ordered, spans the whole `statsDays` range. Each point aggregates `viewsGroupInterval` worth of views, starting at `date`
    
    
    Items:
      Type: object
      
      - `date` (optional)
        Type: string, date-time
      
      - `views` (optional)
        Type: integer
  
  - `viewsGroupInterval` (optional)
    Type: string
    
    bucket size of `viewsPerDay`, only included when `withStats` is true
    
    enum: ["day","week","month"]
  
  - `totalViews` (optional)
    Type: integer
    
    lifetime views of all the channel videos, only included when `withStats` is true

## Examples

### cURL

```bash
curl -X GET 'https://peertube2.cpy.re/api/v1/users/me/subscriptions/my_username%20%7C%20my_username%40example.com' \
  -H 'Authorization: Bearer YOUR_TOKEN'
```

### JavaScript

```javascript
const response = await fetch('https://peertube2.cpy.re/api/v1/users/me/subscriptions/my_username%20%7C%20my_username%40example.com', {
  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/users/me/subscriptions/my_username%20%7C%20my_username%40example.com',
    headers={
        'Authorization': 'Bearer YOUR_TOKEN',
    },
)
print(response.text)
```
