---
title: "List snippets"
method: GET
path: "/workspaces/{workspace_id}/snippets"
tags: ["Snippets"]
---

# List snippets

`GET /workspaces/{workspace_id}/snippets`

## Request

- Base URL: `https://app.mammoth.io/api/v2`
- URL: `https://app.mammoth.io/api/v2/workspaces/{workspace_id}/snippets`
- Auth: one of:
  - HTTP bearer
  - API key in header `X-API-KEY` and API key in header `X-API-SECRET` and API key in header `X-WORKSPACE-ID`

List snippets with pagination, search, and filtering

## Path parameters

- `workspace_id` integer, required: Workspace refers to a collection of projects. Workspace ID is unique identifier for workspace.

## Query parameters

- `limit` integer: Max number of result to return
- `offset` integer: Distance from the beginning of the list of results
- `search` string, nullable: Search parameters by name or description
- `group_id` integer, nullable: Filter parameters by group ID
- `sort` string, nullable: Sort snippets
- `project_id` integer, nullable: Filter by project ID. Omit for workspace-scoped only.

## Response `200`

List SnippetListResponse

- SnippetListResponse
  - `total_count` integer, required
  - `offset` integer, required
  - `limit` integer, required
  - `next` string, required
  - `items` SnippetResponse[], required: List of snippets
    - `id` integer, required: Snippet ID
    - `name` string, required: Snippet name
    - `code` string, required: Snippet source code
    - `language` string, required: Snippet language
    - `description` string, nullable: Snippet description
    - `scope` string, required: Scope of the snippet
    - `group_id` integer, nullable: Parameter group ID
    - `group_name` string, nullable: Name of the parameter group
    - `pipeline_count` integer, required: Number of pipelines using this snippet
    - `stale_pipelines` integer[]: Dataview IDs of stale pipelines using this snippet
    - `referenced_parameters` string[], required: Names of parameters used in the snippet code
    - `created_by` integer, required: User ID who created the snippet
    - `created_at` string, required: Creation timestamp
    - `updated_by` integer, nullable: User ID who last updated the snippet
    - `updated_at` string, required: Last update timestamp

## Other responses

- `400`: Bad Request
- `401`: Authorization error
- `403`: Request forbidden -- authorization will not help

---

[API](https://skmtc.dev/mammoth/apis/mammoth-analytics.md) · [All operations](https://skmtc.dev/mammoth/apis/mammoth-analytics/llms.txt) · [OpenAPI document](https://skmtc.dev/mammoth/apis/mammoth-analytics/revisions/5dfd1c296ded?raw)
