GET
/
v1
/
snippets
List all snippets
curl --request GET \
  --url https://api.checklyhq.com/v1/snippets \
  --header 'Authorization: <api-key>'
[
  {
    "id": 1,
    "name": "Snippet",
    "script": "request.url = request.url + '/extra'",
    "created_at": "2023-11-07T05:31:56Z",
    "updated_at": "2023-11-07T05:31:56Z"
  }
]

Overview

The List Snippets endpoint returns all reusable code snippets available in your Checkly account. Snippets are reusable pieces of code that can be shared across multiple checks to maintain consistency and reduce duplication. Common Use Cases:
  • Code Reusability Management
  • Shared Function Libraries
  • Template Discovery
  • Code Organization
Snippets help maintain consistency across checks and reduce code duplication. Use them for common functions, authentication logic, and shared utilities.

Authorizations

Authorization
string
header
required

The Checkly Public API uses API keys to authenticate requests. You can get the API Key here.

Your API key is like a password: keep it secure!

Authentication to the API is performed using the Bearer auth method in the Authorization header and using the account ID.

For example, set Authorization header while using cURL:

curl -H "Authorization: Bearer [apiKey]" "X-Checkly-Account: [accountId]"

Headers

x-checkly-account
string

Your Checkly account ID, you can find it at https://app.checklyhq.com/settings/account/general

Query Parameters

limit
integer
default:10

Limit the number of results

Required range: 1 <= x <= 100
page
number
default:1

Page number

Response

Successful

id
number
Example:

1

name
string

The snippet name.

Example:

"Snippet"

script
string

Your Node.js code that interacts with the API check lifecycle, or functions as a partial for browser checks.

Example:

"request.url = request.url + '/extra'"

created_at
string<date-time>
updated_at
string<date-time>