---
title: "Retrieve a set of Snippets by query"
method: GET
path: "/snippets"
tags: ["snippet"]
---

# Retrieve a set of Snippets by query

`GET /snippets`

Used to query Snippets

## Query parameters

- `workspace_id` string, required
- `snippet_type` 'css' | 'javascript' | 'xpath' | 'sql' | 'postman'
- `includeNonReusable` boolean
- `limit` integer
- `cursor` string

## Response `200`

Array of Snippets matching the query

- SnippetQueryResult — result envelope for Snippet query results
  - `snippets` Snippet[] — All Snippets that matched the query
    - `invariant_id` string — Object ID for the parent type. Set by system.
    - `description` string — Summary of the Snippet
    - `name` string — The display name of the Snippet
    - `body` string — the base64 encoded body of the Snippet
    - `snippet_type` 'css' | 'javascript' | 'xpath' | 'sql' | 'postman'
    - `reusable` boolean — Indicates whether the snippet is reusable
    - `workspace_id` string — The ID of the workspace that this Snippet belongs to
    - `id` string — Object id. Set by system.
    - `is_latest` boolean — Indicates whether this was the latest variant when retrieved
    - `version` integer — The generation number of this variant
    - `previous_version` integer — The generation number of the variant that was edited to create this variant (if applicable)
    - `merged_version` integer — The generation number of the variant that was merged with the previous version to create this variant (if applicable)
    - `created_on_branch` string — Name of the branch the snippet's variant was created on
    - `change_description` string — Description of the change between this variant and the previous variant
    - `last_updated_time` integer — time the Snippet object was last updated
    - `last_updated_by_id` string — The ID of the user who last updated this Snippet
    - `variant_last_updated_time` integer — time the Snippet's variant was last updated
    - `variant_last_updated_by_id` string — The ID of the user who last updated this Snippet's variant
    - `created_time` integer — time the Snippet was created
    - `created_by_id` string — The ID of the user who created this Snippet
    - `labels` Label[] — User provided labels
      - `name` string, required — name
      - `color` string — color
    - `parameters` SnippetParameter[] — Snippet parameters supplied to the snippet
      - `id` string, required — The ID of the parameter
      - `name` string, required — The name of the parameter
      - `description` string — The description of the parameter
      - `default_value` string — The default value of the parameter
    - `revision_history` string — Graph describing the snippet's version history
    - `database_connection_id` string — If the snippet is a SQL snippet, the database connection id.
  - `cursor` string — Cursor used for pagination

## Other responses

- `400` — Invalid or missing parameter
- `401` — User not authenticated
- `403` — User not authorized
- `default` — Unknown error

---

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