# Request registration

`POST /api/v1/users/registrations/request`

Signup has to be enabled and require approval on the instance

Authentication: no security requirement declared for this operation.

Request body: application/json

Type: RegisterUser & object

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

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

  Type: object
  
  - `registrationReason` (required)
    Type: string
    
    reason for the user to register on the instance

Responses:

- 200: successful operation

Content type: application/json

Type: object

- `state` (optional)
  Type: object
  
  - `id` (optional)
    Reference: [UserRegistrationState](https://sourcey-peertube.pages.dev/api-rest-reference/models/userregistrationstate.md); Type: UserRegistrationState
    
    The registration state (Pending = `1`, Rejected = `2`, Accepted = `3`)
    
    enum: [1,2,3]
  
  - `label` (optional)
    Type: string

- 400: request error or signup approval is not enabled on the instance

- 403: user registration is not enabled, user limit is reached, registration is not allowed for the ip or blocked by a plugin

- 409: a user or registration with this username, channel name or email already exists

## Examples

### cURL

```bash
curl -X POST 'https://peertube2.cpy.re/api/v1/users/registrations/request' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "password": "********",
  "email": "user@example.com",
  "displayName": "string",
  "channel": {
    "name": "framasoft_videos",
    "displayName": "string"
  },
  "signupClient": "peertube-app",
  "registrationReason": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "password": "********",
  "email": "user@example.com",
  "displayName": "string",
  "channel": {
    "name": "framasoft_videos",
    "displayName": "string"
  },
  "signupClient": "peertube-app",
  "registrationReason": "string"
}`;

const response = await fetch('https://peertube2.cpy.re/api/v1/users/registrations/request', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "password": "********",
  "email": "user@example.com",
  "displayName": "string",
  "channel": {
    "name": "framasoft_videos",
    "displayName": "string"
  },
  "signupClient": "peertube-app",
  "registrationReason": "string"
}'''

response = requests.post(
    'https://peertube2.cpy.re/api/v1/users/registrations/request',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
