# Create a custom code block

`POST https://api.cademi.com.br/api/v3/settings/custom-code`

Operation ID: `custom_code.create` · API v3

Creates a custom code block that is injected into the platform pages.

Creating a block with `type` set to `pushalertco` also requires the `custom_code.manage_pwa` permission.

Code content is stored exactly as submitted and is not sanitized.

Required permissions: `custom_code.write`, `custom_code.manage_pwa`.

## Request body

Content type: `application/json`, required.

| Field | Type | Required | Description |
|---|---|---|---|
| `content` | object | no |  |
| `name` | string | yes |  |
| `position` | string, one of `head`, `body` | yes |  |
| `type` | string | yes |  |

## Responses

### 201

Returns the newly created custom code block.

Body: `data`: CustomCode.

Fields of CustomCode:

| Field | Type | Required | Description |
|---|---|---|---|
| `content` | object or null | no | Code content. Returned only when retrieving a single custom code block with a credential that has the customcode.readcontent permission. |
| `created_at` | string (date-time) | yes |  |
| `deleted` | boolean | yes |  |
| `id` | string | yes |  |
| `name` | string | yes |  |
| `object` | string, one of `custom_code` | yes |  |
| `position` | string, one of `head`, `body` | yes |  |
| `revision` | string | yes |  |
| `status` | string, one of `active`, `inactive` | yes |  |
| `type` | string, one of `active-campaign`, `custom`, `facebook-pixel`, `analytics`, `tagmanager`, `pushalertco`, `whats` | yes |  |
| `updated_at` | string (date-time) | yes |  |

### 401

The credential is missing, malformed, expired, or revoked.

Body: Error.

### 403

The current credentials do not have the permission required by this operation.

Body: Error.

### 422

The request body or query parameters failed validation.

Body: ValidationFailed.

Full schema: https://cademi.dev/openapi/v3.json
