---
title: "Create a snippet for a workspace"
method: POST
path: "/snippets/{workspace}"
tags: ["Snippets"]
---

# Create a snippet for a workspace

`POST /snippets/{workspace}`

Identical to [`/snippets`](/cloud/bitbucket/rest/api-group-snippets/#api-snippets-post), except that the new snippet will be
created under the workspace specified in the path parameter
`{workspace}`.

## Request body

- Snippet — A snippet object.
  - `type` string, required
  - `id` integer
  - `title` string
  - `scm` 'git' — The DVCS used to store the snippet.
  - `created_on` string, date-time
  - `updated_on` string, date-time
  - `owner` Account — An account object.
    - `type` string, required
    - `links` AccountLinks — Links related to an Account.
      - `avatar` Link — A link to a resource related to this object.
        - `href` string, uri
        - `name` string
    - `created_on` string, date-time
    - `display_name` string
    - `uuid` string
  - `creator` Account — An account object.
    - `type` string, required
    - `links` AccountLinks — Links related to an Account.
      - `avatar` Link — A link to a resource related to this object.
        - `href` string, uri
        - `name` string
    - `created_on` string, date-time
    - `display_name` string
    - `uuid` string
  - `is_private` boolean

## Response `201`

The newly created snippet object.

- Snippet — A snippet object.
  - `type` string, required
  - `id` integer
  - `title` string
  - `scm` 'git' — The DVCS used to store the snippet.
  - `created_on` string, date-time
  - `updated_on` string, date-time
  - `owner` Account — An account object.
    - `type` string, required
    - `links` AccountLinks — Links related to an Account.
      - `avatar` Link — A link to a resource related to this object.
        - `href` string, uri
        - `name` string
    - `created_on` string, date-time
    - `display_name` string
    - `uuid` string
  - `creator` Account — An account object.
    - `type` string, required
    - `links` AccountLinks — Links related to an Account.
      - `avatar` Link — A link to a resource related to this object.
        - `href` string, uri
        - `name` string
    - `created_on` string, date-time
    - `display_name` string
    - `uuid` string
  - `is_private` boolean

## Other responses

- `401` — If the request was not authenticated
- `403` — If the authenticated user does not have permission to create snippets in the specified workspace.

---

[API](https://skmtc.net/atlassian/apis/bitbucket-api.md) · [All operations](https://skmtc.net/atlassian/apis/bitbucket-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/atlassian/bitbucket-api/versions/8c7911c0a910/schema)
