# Create static gate

> Source: https://truto.one/docs/api-reference/admin/static-gates/create/

`POST /static-gate`

Resource: **Static Gates**

## Request body

- **`name`** _(string)_
  A descriptive name for the static gate.
- **`domain`** _(string)_
  The domain this static gate will proxy requests for.
- **`environment_id`** _(string)_
  The ID of the environment this static gate will be scoped to.
- **`api_token_secret`** _(string)_
  Optional API token secret. If not provided, one will be generated automatically.

## Response body

- **`id`** _(string)_
  The ID of the static gate.
- **`name`** _(string)_
  A descriptive name for the static gate.
- **`domain`** _(string)_
  The domain this static gate will proxy requests for.
- **`created_by`** _(string)_
  The ID of the user who created this static gate.
- **`environment_id`** _(string)_
  The ID of the environment this static gate is scoped to.
- **`created_at`** _(string)_
  The date and time when the static gate was created.
- **`updated_at`** _(string)_
  The date and time when the static gate was last updated.
- **`api_token`** _(string)_
  The generated API token for this static gate.

## Code examples

### curl

```bash
curl -X POST 'https://api.truto.one/static-gate' \
  -H 'Authorization: Bearer <your_api_token>' \
  -H 'Content-Type: application/json' \
  -d '{
  "name": "My Static Gate",
  "domain": "api.example.com",
  "environment_id": "8a2b104d-74a6-47f2-b93e-c6b611e82391",
  "api_token_secret": "your-api-token-secret"
}'
```

### JavaScript

```javascript
const body = {
  "name": "My Static Gate",
  "domain": "api.example.com",
  "environment_id": "8a2b104d-74a6-47f2-b93e-c6b611e82391",
  "api_token_secret": "your-api-token-secret"
};

const response = await fetch('https://api.truto.one/static-gate', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer <your_api_token>',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify(body),
});

const data = await response.json();
console.log(data);
```

### Python

```python
import requests

url = "https://api.truto.one/static-gate"
headers = {
    "Authorization": "Bearer <your_api_token>",
    "Content-Type": "application/json",
}
params = {
}
payload = {
    "name": "My Static Gate",
    "domain": "api.example.com",
    "environment_id": "8a2b104d-74a6-47f2-b93e-c6b611e82391",
    "api_token_secret": "your-api-token-secret"
}

response = requests.post(url, headers=headers, params=params, json=payload)
print(response.json())
```

### Truto TS SDK

```typescript
import Truto from '@truto/truto-ts-sdk';

const truto = new Truto({
  token: '<your_api_token>',
});

const body = {
  "name": "My Static Gate",
  "domain": "api.example.com",
  "environment_id": "8a2b104d-74a6-47f2-b93e-c6b611e82391",
  "api_token_secret": "your-api-token-secret"
};

const result = await truto.staticGate.create(body);

console.log(result);
```

### Truto Python SDK

```python
import asyncio
from truto_python_sdk import TrutoApi

truto_api = TrutoApi(token="<your_api_token>")

async def main():
    body = {
        "name": "My Static Gate",
        "domain": "api.example.com",
        "environment_id": "8a2b104d-74a6-47f2-b93e-c6b611e82391",
        "api_token_secret": "your-api-token-secret"
    }

    result = await truto_api.static_gates.create(body)
    print(result)

asyncio.run(main())
```
