# Create new tenant. The user who creates the tenant is given the super admin role.

`POST /api/tenant`

Authentication (security requirement alternatives):

```json
[
  {
    "role": [
      "SUPER_ADMIN"
    ]
  }
]
```

- role; scopes: SUPER_ADMIN

Request body: application/json (required)

Type: object

Schema: [CreateTenantDTO](https://sourcey-gauzy.pages.dev/api-reference/models/createtenantdto/index.md)

- `name` (required)
  Type: string

- `logo` (optional)
  Type: string

- `imageId` (optional)
  Type: string

- `stripeCheckoutSessionId` (optional)
  Type: string
  
  Stripe Checkout Session id (cs_live_... / cs_test_...)

Responses:

- 201: The record has been successfully created.

- 400: Invalid input, The response body may contain clues as to what went wrong

## Examples

### cURL

```bash
curl -X POST 'http://localhost:3000/api/tenant' \
  -H 'Content-Type: application/json' \
  --data-raw '{
  "name": "string",
  "logo": "string",
  "imageId": "string",
  "stripeCheckoutSessionId": "string"
}'
```

### JavaScript

```javascript
const body = `{
  "name": "string",
  "logo": "string",
  "imageId": "string",
  "stripeCheckoutSessionId": "string"
}`;

const response = await fetch('http://localhost:3000/api/tenant', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
  },
  body,
});

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

### Python

```python
import requests

body = '''{
  "name": "string",
  "logo": "string",
  "imageId": "string",
  "stripeCheckoutSessionId": "string"
}'''

response = requests.post(
    'http://localhost:3000/api/tenant',
    data=body.encode('utf-8'),
    headers={
        'Content-Type': 'application/json',
    },
)
print(response.text)
```
