---
title: VCL
summary: >-
  A VCL is a Varnish configuration file used to customize the configuration for
  a Service.
url: https://www.fastly.com/documentation/reference/api/vcl-services/vcl
---

A VCL is a Varnish configuration file used to customize the configuration for a Service.

## Data model

| Field | Type | Description |
|-------|------|-------------|
| `errors` | array |  |
| `messages` | array |  |
| `warnings` | array |  |
| `content` | string | The VCL code to be included. |
| `main` | boolean | Set to <code>true</code> when this is the main VCL, otherwise <code>false</code>. |
| `name` | string | The name of this VCL. |
| `created_at` | string | Date and time in ISO 8601 format. (Read-only) |
| `deleted_at` | string | Date and time in ISO 8601 format. (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` | integer | Integer identifying a service version. (Read-only) |

## API endpoints

### List custom VCL files

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

List the uploaded VCLs 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 custom VCL file

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

Upload a VCL 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 boilerplate VCL

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

Return boilerplate VCL with the service's TTL from the <a href="https://www.fastly.com/documentation/reference/api/vcl-services/settings/">settings</a>.

**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 custom VCL file

**GET** `/service/{service_id}/version/{version_id}/vcl/{vcl_name}`

Get the uploaded VCL for a particular service and version.

**Parameters:**

| Name | Type | In | Required | Description |
|------|------|----|---------|--------------|
| `no_content` | string | query | No | Omit VCL content. |
| `service_id` | string | path | Yes | Alphanumeric string identifying the service. |
| `vcl_name` | string | path | Yes | The name of this VCL. |
| `version_id` | integer | path | Yes | Integer identifying a service version. |

### Update a custom VCL file

**PUT** `/service/{service_id}/version/{version_id}/vcl/{vcl_name}`

Update the uploaded VCL for a particular service and version.

**Parameters:**

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

### Delete a custom VCL file

**DELETE** `/service/{service_id}/version/{version_id}/vcl/{vcl_name}`

Delete the uploaded VCL for a particular service and version.

**Parameters:**

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

### Get a custom VCL file with syntax highlighting

**GET** `/service/{service_id}/version/{version_id}/vcl/{vcl_name}/content`

Get the uploaded VCL for a particular service and version with HTML syntax highlighting. Include line numbers by sending <code>lineno=true</code> as a request parameter.

**Parameters:**

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

### Download a custom VCL file

**GET** `/service/{service_id}/version/{version_id}/vcl/{vcl_name}/download`

Download the specified VCL.

**Parameters:**

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

### Get the generated VCL for a service

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

Display the generated VCL 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 the generated VCL with syntax highlighting

**GET** `/service/{service_id}/version/{version_id}/generated_vcl/content`

Display the content of generated VCL with HTML syntax highlighting. Include line numbers by sending <code>lineno=true</code> as a request parameter.

**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. |

### Set a custom VCL file as main

**PUT** `/service/{service_id}/version/{version_id}/vcl/{vcl_name}/main`

Set the specified VCL as the main.

**Parameters:**

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

### Lint (validate) VCL using flags set for the service

**POST** `/service/{service_id}/lint`

Services may have flags set by a Fastly employee or by the purchase of products as addons to the service, which modify the way VCL is interpreted by that service.  This endpoint validates the submitted VCL in the context of the specified service.

**Parameters:**

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

### Lint (validate) VCL using a default set of flags

**POST** `/vcl_lint`

This endpoint validates the submitted VCL against a default set of enabled flags. Consider using the <code>/service/{service_id}/lint</code> operation to validate VCL in the context of a specific service.
