---
title: "Create a snippet"
method: POST
path: "/v1/snippets"
tags: ["Snippets"]
---

# Create a snippet

`POST /v1/snippets`

Creates a new snippet.

## Headers

- `x-checkly-account` string — Your Checkly account ID, you can find it at https://app.checklyhq.com/settings/account/general

## Request body

- SnippetCreate
  - `name` string, required — The snippet name.
  - `script` string, required — Your Node.js code that interacts with the API check lifecycle, or functions as a partial for browser checks.

## Response `201`

Created

- Snippet
  - `id` number
  - `name` string — The snippet name.
  - `script` string — Your Node.js code that interacts with the API check lifecycle, or functions as a partial for browser checks.
  - `created_at` string, date-time
  - `updated_at` string, date-time, nullable

## Other responses

- `400` — Bad Request
- `401` — Unauthorized
- `403` — Forbidden
- `429` — Too Many Requests

---

[API](https://skmtc.net/checklyhq/apis/checkly-public-api.md) · [All operations](https://skmtc.net/checklyhq/apis/checkly-public-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/checklyhq/checkly-public-api/revisions/87d29dc7b4fe/schema)
