---
title: VCL Snippets
summary: >-
  VCL Snippets are blocks of VCL logic inserted into your service's
  configuration that don't require custom VCL.
url: https://www.fastly.com/documentation/reference/api/vcl-services/snippet
---

VCL Snippets are blocks of VCL logic inserted into your service's configuration that don't require custom VCL.

## Data model

| Field | Type | Description |
|-------|------|-------------|
| `content` | string | The VCL code that specifies exactly what the snippet does. |
| `dynamic` | string | Sets the snippet version. |
| `name` | string | The name for the snippet. |
| `priority` | string | Priority determines execution order. Lower numbers execute first. |
| `type` | string | The location in generated VCL where the snippet should be placed. |
| `created_at` | string | Date and time in ISO 8601 format. (Read-only) |
| `deleted_at` | string | Date and time in ISO 8601 format. (Read-only) |
| `id` | string | Alphanumeric string identifying a VCL Snippet. (Read-only) |
| `service_id` | string | Alphanumeric string identifying the service. (Read-only) |
| `updated_at` | string | Date and time in ISO 8601 format. (Read-only) |
| `version` | string | String representing the number identifying a version of the service. (Read-only) |

## API endpoints

### Get a dynamic snippet

**GET** `/service/{service_id}/snippet/{id}`

Get a single dynamic snippet for a particular service.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `id` | string | path | Yes | Alphanumeric string identifying a VCL Snippet. |
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |

### Update a dynamic snippet

**PUT** `/service/{service_id}/snippet/{id}`

Update a dynamic snippet for a particular service.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `id` | string | path | Yes | Alphanumeric string identifying a VCL Snippet. |
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |

### List snippets

**GET** `/service/{service_id}/version/{version_id}/snippet`

List all snippets for a particular service and version.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |

### Create a snippet

**POST** `/service/{service_id}/version/{version_id}/snippet`

Create a snippet for a particular service and version.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |

### Get a versioned snippet

**GET** `/service/{service_id}/version/{version_id}/snippet/{name}`

Get a single snippet for a particular service and version.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `name` | string | path | Yes | The name for the snippet. |
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |

### Update a versioned snippet

**PUT** `/service/{service_id}/version/{version_id}/snippet/{name}`

Update a specific snippet for a particular service and version.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `name` | string | path | Yes | The name for the snippet. |
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |

### Delete a snippet

**DELETE** `/service/{service_id}/version/{version_id}/snippet/{name}`

Delete a specific snippet for a particular service and version.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `name` | string | path | Yes | The name for the snippet. |
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |
