LOG IN SIGN UP
Documentation

This section of the API documentation covers the pragmatic configuration of your services, in complement to the web interface.

As always, if something does not work as expected or differs from the web interface, please contact us right away via our Support Desk or IRC (#fastly on Freenode, or webchat).

Authentication

Nearly all API calls require your request to be authenticated though a few do not. Most support using an API key alone (labeled below as Authentication: key), but a few account level calls require using an authenticated session cookie (labeled as Authentication: session. See our Authentication page for details on each.

API reference

The main entry point for the API is https://api.fastly.com/. For the sake of brevity, examples below omit this.

Backend

A Backend is an address (ip or domain) from which Fastly pulls content. There can be multiple Backends for a Service.

Fields

Actions

GET /service/service_id/version/version/backend/name

Get the backend for a particular service and version

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/backend/test-backend
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"name": "test-backend",
"error_threshold": "0",
"between_bytes_timeout": "10000",
"connect_timeout": "1000",
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"port": "9092",
"weight": "100",
"healthcheck": null,
"client_cert": null,
"version": "1",
"first_byte_timeout": "15000",
"ipv4": "127.0.0.1",
"hostname": null,
"ipv6": null,
"max_conn": "20",
"use_ssl": "0"
"address": "hostname"
"comment": "backend tester"
"request_condition": ""
"auto_loadbalance": "false"
}
POST /service/service_id/version/version/backend

Create a backend for a particular service and version

Authentication

key_or_engineer

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/backend
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
ipv4=127.0.0.1;version=3;name=test-backend;port=9092;service=SU1Z0isxPaozGVKXdv0eY
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"name": "test-backend",
"error_threshold": "0",
"between_bytes_timeout": "10000",
"connect_timeout": "1000",
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"port": "9092",
"weight": "100",
"healthcheck": null,
"client_cert": null,
"version": "1",
"first_byte_timeout": "15000",
"ipv4": "127.0.0.1",
"hostname": null,
"ipv6": null,
"max_conn": "20",
"use_ssl": "0"
"address": "hostname"
"comment": "backend tester"
"request_condition": ""
"auto_loadbalance": "false"
}
GET /service/service_id/version/version/backend

List all backends for a particular service and version

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/backend
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"name": "test-backend",
"error_threshold": "0",
"between_bytes_timeout": "10000",
"connect_timeout": "1000",
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"port": "9092",
"weight": "100",
"healthcheck": null,
"client_cert": null,
"version": "1",
"first_byte_timeout": "15000",
"ipv4": "127.0.0.1",
"hostname": null,
"ipv6": null,
"max_conn": "20",
"use_ssl": "0"
"address": "hostname"
"comment": "backend tester"
"request_condition": ""
"auto_loadbalance": "false"
}
]
DELETE /service/service_id/version/version/backend/name

Delete the backend for a particular service and version

Authentication

key_or_engineer

Request Example
DELETE /service/SU1Z0isxPaozGVKXdv0eY/version/1/backend/test-backend
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"status":"ok"
}
PUT /service/service_id/version/version/backend/old_name

Update the backend for a particular service and version

Authentication

key_or_engineer

Parameters

  • old_name - Old name of the backend (used to select the correct backend if the name has been changed).

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/backend/test-backend
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
name=updated-test-backend
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"name": "updated-test-backend",
"error_threshold": "0",
"between_bytes_timeout": "10000",
"connect_timeout": "1000",
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"port": "9092",
"weight": "100",
"healthcheck": null,
"client_cert": null,
"version": "1",
"first_byte_timeout": "15000",
"ipv4": "127.0.0.1",
"hostname": null,
"ipv6": null,
"max_conn": "20",
"use_ssl": "0"
"address": "hostname"
"comment": "backend tester"
"request_condition": ""
"auto_loadbalance": "false"
}

Cache Settings

Controls how caching is performed on Fastly. When used in conjunction with Conditions the Cache Settings provide you with fine grain control over how long content persists in the cache.

Fields

Actions

GET /service/service_id/version/version/cache_settings/name

Get a specific cache settings object.

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/cache_settings/testcache
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"stale_ttl":"1000",
"ttl":"1000",
"action":"cache",
"cache_condition":"",
"name":"testcache",
"version":"1",
"service_id":"SU1Z0isxPaozGVKXdv0eY"
}
GET /service/service_id/version/version/cache_settings

Get a list of all cache settings for a particular service and version.

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/cache_settings
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"stale_ttl":"1000",
"ttl":"1000",
"action":"cache",
"cache_condition":"",
"name":"testcache",
"version":"1",
"service_id":"SU1Z0isxPaozGVKXdv0eY"
},
...
]
POST /service/service_id/version/version/cache_settings

Create a new cache settings object.

Authentication

key_or_engineer

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/cache_settings
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
name=testcache&stale_ttl=1000&ttl=1000&action=cache
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"stale_ttl":"1000",
"ttl":"1000",
"action":"cache",
"cache_condition":"",
"name":"testcache",
"version":"1",
"service_id":"SU1Z0isxPaozGVKXdv0eY"
}
DELETE /service/service_id/version/version/cache_settings/name

Delete a specific cache settings object.

Authentication

key_or_engineer

Request Example
DELETE /service/SU1Z0isxPaozGVKXdv0eY/version/1/backend/check_all
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"status":"ok"
}
PUT /service/service_id/version/version/cache_settings/old_name

Update a specific cache settings object.

Authentication

key_or_engineer

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/cache_settings/testcache
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
stale_ttl=2000&ttl=1000
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"stale_ttl":"2000",
"ttl":"1000",
"action":"cache",
"cache_condition":"",
"name":"testcache",
"version":"1",
"service_id":"SU1Z0isxPaozGVKXdv0eY"
}

Condition

Conditions are used to control when and how other objects are used in a service configuration. They contain a statement that evaluates to either true or false and is used to determine whether the condition is met.

Depending on the type of the condition, the statment field can make reference to the Varnish Variables req, resp, and/or beresp.

Fields

Actions

GET /service/service_id/version/version/condition/name

Gets the specified condition.

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/condition/testcondition
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"type":"REQUEST",
"comment":"",
"name":"testcondition",
"version":"1",
"service_id":"SU1Z0isxPaozGVKXdv0eY",
"statement":"req.url~ \"index.html\"",
"priority":"10"
}
GET /service/service_id/version/version/condition

Gets all conditions for a particular service and version.

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/condtion
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"type":"REQUEST",
"comment":"",
"name":"testcondition",
"version":"1",
"service_id":"SU1Z0isxPaozGVKXdv0eY",
"statement":"req.url~ \"index.html\"",
"priority":"10"
},
...
]
POST /service/service_id/version/version/condition

Creates a new condition.

Authentication

key_or_engineer

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/condition
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
name=testcondition&statement=req.url~+\"index.html\"&priority=10
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"type":"REQUEST",
"comment":"",
"name":"testcondition",
"version":"1",
"service_id":"SU1Z0isxPaozGVKXdv0eY",
"statement":"req.url~ \"index.html\"",
"priority":"10"
}
DELETE /service/service_id/version/version/condition/name

Deletes the specified condition.

Authentication

key_or_engineer

Request Example
DELETE /service/SU1Z0isxPaozGVKXdv0eY/version/1/condition/testcondition
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"status":"ok"
}
PUT /service/service_id/version/version/condition/old_name

Updates the specified condition.

Authentication

key_or_engineer

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/condition/testcondition
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
name=testcondition&statement=req.url~+\"index.html\"&priority=10
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"type":"REQUEST",
"comment":"",
"name":"testcondition",
"version":"1",
"service_id":"SU1Z0isxPaozGVKXdv0eY",
"statement":"req.url~ \"index.html\"",
"priority":"10"
}

Content

Fastly makes it possible to see which version of a particular url is cached on each edge server.

Actions

GET /content/edge_check

Retrieve headers and MD5 hash of the content for a particular url from each Fastly edge server

Authentication

none

Parameters

  • url - full URL (host and path) to check on all nodes. if protocol is omitted, http will be assumed

Request Example
GET /content/edge_check?url=www.mysite.com/foo/bar
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
[
"cache-a15",
{
"body_hash" : "d41d8cd98f00b204e9800998ecf8427e",
"headers" : {
"x-served-by" : "cache-a15-AMS",
"connection" : "close",
"date" : "Tue, 07 Feb 2012 01:50:45 GMT",
"age" : "0",
"via" : "1.1 varnish",
"retry-after" : "0",
"x-cache-hits" : "0",
"x-cache" : "MISS",
"server" : "Varnish"
},
"status_code" : 550,
"time" : 377
}
],
...
]

Diff

See the changes in configuration between two different versions of a service.

Fields

Actions

GET /service/service_id/diff/from/from/to/to

Get diff between two versions

Authentication

key_or_engineer

Parameters

  • from - the version to diff from. Can either be a positive number from 1 to your maximum version or a negative number from -1 down (-1 is latest version etc)
  • to - the version to diff to. Uses same numbering scheme as from
  • format - optional method to format the diff field. Can either be text (default), html or html_simple

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/diff/from/1/to/2
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"format": "text",
"from": 1,
"to": 2
"diff": " ---
backends:
- name: My Backend
address: backend.example.com
auto_loadbalance: '0'
between_bytes_timeout: 10000
client_cert:
comment: ''
connect_timeout: 1000
error_threshold: 0
first_byte_timeout: 15000
healthcheck:
hostname: www.example.com
ipv4:
ipv6:
max_conn: 200
port: 80
request_condition: ''
shield:
ssl_ca_cert:
ssl_client_cert:
ssl_client_key:
ssl_hostname:
use_ssl: false
weight: 100
cache_settings: []
comment: ''
conditions: []
deployed:
directors: []
domains:
- name: www.example.com
comment: ''
gzips: []
-headers: []
+headers:
+- name: Debug
+ action: set
+ cache_condition:
+ dst: http.X-Test
+ ignore_if_set: '0'
+ priority: '10'
+ regex: ''
+ request_condition:
+ response_condition:
+ src: '"testing"'
+ substitution: ''
+ type: request
healthchecks: []
inherit_service_id:
matches: []
origins: []
request_settings: []
response_objects: []
service_id: SU1Z0isxPaozGVKXdv0eY
settings:
general.default_host: ''
general.default_ttl: 3600
staging:
syslogs: []
testing:
vcls: []
wordpress: []
"
}

Director

A Director is responsible for balancing requests among a group of Backends. In addition to simply balancing, Directors can be configured to attempt retrying failed requests. Additionally, Directors have a quorum setting which can be used to determine when the Director as a whole is considered "up", in order to prevent "server whack-a-mole" following an outage as servers come back up.

Fields

Actions

GET /service/service_id/version/version/director/name

Get the director for a particular service and version

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/director/test-director
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"name": "test-director",
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version": "1"
"type": "1",
"retries": "5",
"quorum": "75",
}
GET /service/service_id/version/version/director

List the directors for a particular service and version

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/director
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"name": "test-director",
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version": "1"
"type": "1",
"retries": "5",
"quorum": "75",
}
]
POST /service/service_id/version/version/director

Create a director for a particular service and version

Authentication

key_or_engineer

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/director
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
name=test-director
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"name": "test-director",
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version": "1"
"type": "1",
"retries": "5",
"quorum": "75",
"capacity", "100"
}
DELETE /service/service_id/version/version/director/name

Delete the director for a particular service and version

Authentication

key_or_engineer

Request Example
DELETE /service/SU1Z0isxPaozGVKXdv0eY/version/1/director/test-director
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"status":"ok"
}
PUT /service/service_id/version/version/director/name

Update the director for a particular service and version

Authentication

key_or_engineer

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/director/test-director
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
id=updated-director;retries=10
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"name": "updated-director",
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version": "1"
"type": "1",
"retries": "10",
"quorum": "75",
}

Director Backend

Maps and relates backends as belonging to directors. Backends can belong to any number of directors but directors can only hold one reference to a specific backend.

Fields

Actions

GET /service/service_id/version/version/director/director_name/backend/backend_name

Returns the relationship between a Backend and a Director. If the Backend has been associated with the Director, it returns a simple record indicating this. Otherwise, returns a 404.

Authentication

key_or_engineer

Request Example
GET /service/6N2jxQPVlKfETea4s1yv1z/version/2/director/test/backend/test HTTP/1.1
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
{
"service_id": "6N2jxQPVlKfETea4s1yv1z"
"version": 2,
"director": "test",
"backend": "test",
"created": "2012-07-14T00:18:25+00:00",
"updated": "2012-07-14T00:18:25+00:00",
"deleted": null,
}
POST /service/service_id/version/version/director/director_name/backend/backend_name

Establishes a relationship between a Backend and a Director. The Backend is then considered a member of the Director and can be used to balance traffic onto.

Authentication

key_or_engineer

Request Example
POST /service/6N2jxQPVlKfETea4s1yv1z/version/2/director/test/backend/test HTTP/1.1
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
{
"service_id": "6N2jxQPVlKfETea4s1yv1z"
"version": 2,
"director": "test",
"backend": "test",
"created": "2012-07-14T00:18:25+00:00",
"updated": "2012-07-14T00:18:25+00:00",
"deleted": null,
}
DELETE /service/service_id/version/version/director/director_name/backend/backend_name

Deletes the relationship between a Backend and a Director. The Backend is no longer considered a member of the Director and thus will not have traffic balanced onto it from this Director.

Authentication

key_or_engineer

Request Example
DELETE /service/6N2jxQPVlKfETea4s1yv1z/version/2/director/test/backend/test HTTP/1.1
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json;charset=utf-8
{
"status": "ok"
}

Docs

Documentation of the endpoints that return the Fastly API Documentation.

Actions

GET /docs

Gets all documentation associated with the Fastly API.

Authentication

none

Request Example
GET /docs
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"description": [ "An array of strings describing the endpoint",
... ],
"fields": ["one Array of fields",
"two the first word is the field name",
... ],
"section": "Categorical_section",
"actions": [
{
"authentication": "key",
"url": "/docs",
"http_method": "GET",
"description": "Action Description",
"request": ...,
"response": ...,
"response_body": ...,
}
]
}, ...
]
GET /docs/subject/endpoint

Gets all documentation relating to a given 'Subject'

Authentication

none

Request Example
GET /docs/subject/:subject
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"description": [ "An array of strings describing the endpoint",
... ],
"fields": ["one Array of fields",
"two the first word is the field name",
...],
"section": "Categorical_section",
"actions": [
{
"authentication": "key",
"url": "/docs",
"http_method": "GET",
"description": "Action Description",
"request": ...,
"response": ...,
"response_body": ...,
}
]
}
GET /docs/section/section

Gets all documentation associated with a given Categorical Section where :section is a regular_expression. passing invert=true will force a return of everything that does not match the given regular_expression

Authentication

none

Parameters

  • invert - boolean used get everything that does not match section

Request Example
GET /docs/section/:section
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"description": [ "An array of strings describing the endpoint",
... ],
"fields": ["one Array of fields",
"two the first word is the field name",
... ],
"section": "Categorical_section",
"actions": [
{
"authentication": "key",
"url": "/docs",
"http_method": "GET",
"description": "Action Description",
"request": ...,
"response": ...,
"response_body": ...,
}
]
}, ...
]

Domain

A Domain represents the domain name through which visitors will retrieve content. There can be multiple Domains for a Service.

Fields

Actions

GET /service/service_id/version/version/domain/name/check

Checks the status of a domain's DNS record. Returns an array of 3 items. The first is the details for the domain. The second is the current CNAME of the domain. The third is a boolean indicating whether or not it has been properly setup to use Fastly.

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/domain/www.example.com/check
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"name" : "www.example.com",
"comment" : "",
"service_id" : "SU1Z0isxPaozGVKXdv0eY",
"version" : "1",
"locked" : true
},
"global.prod.fastly.net.",
true
]
GET /service/service_id/version/version/domain/check_all

Checks the status of all domain DNS records for a Service Version. Returns an array items in the same format as the single domain /check.

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/domain/check_all
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
[
{
"name" : "www.example.com",
"comment" : "",
"service_id" : "SU1Z0isxPaozGVKXdv0eY",
"version" : "1",
"locked" : true
},
"global.prod.fastly.net",
true
]
]
GET /service/service_id/version/version/domain/name

Get the domain for a particular service and version

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/domain/www.example.com
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"name": "www.example.com",
"comment" : "",
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version": "1",
"locked" : true
}
POST /service/service_id/version/version/domain

Create a domain for a particular service and version

Authentication

key_or_engineer

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/domain
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
name=www.example.com
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"name": "www.example.com",
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version": "1",
"comment" : "",
"locked" : true
}
GET /service/service_id/version/version/domain

List the domains for a particular service and version

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/domain
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"name": "www.example.com",
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version" : "1",
"comment" : "",
"locked" : true
}
]
DELETE /service/service_id/version/version/domain/name

Delete the domain for a particular service and versions

Authentication

key_or_engineer

Request Example
DELETE /service/SU1Z0isxPaozGVKXdv0eY/version/1/domain/test-domain
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"status":"ok"
}
PUT /service/service_id/version/version/domain/old_name

Update the domain for a particular service and version

Authentication

key_or_engineer

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/domain/www.example.com
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
name=new.example.com
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"name": "new.example.com",
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version": "1",
"comment" : "",
"locked" : true
}

Header objects are used to add, modify, or delete headers from requests and responses. The header content can be simple strings or be derived from variables inside Varnish. Regular expressions can be used to customize the headers even further.

Fields

Actions

GET /service/service_id/version/version/header/name

Retrieves a Header object by name.

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/header/testheader
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"ignore_if_set":"0",
"type":"request",
"action":"set",
"substitution":"",
"response_condition":null,
"cache_condition":null,
"request_condition":null,
"regex":"",
"dst":"http.foo",
"src":"client.ip",
"name":"testheader",
"version":"1",
"service_id":"SU1Z0isxPaozGVKXdv0eY",
"priority":"10"
}
GET /service/service_id/version/version/header

Retrieves all Header objects for a particular Version of a Service.

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/header
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"ignore_if_set":"0",
"type":"request",
"action":"set",
"substitution":"",
"response_condition":null,
"cache_condition":null,
"request_condition":null,
"regex":"",
"dst":"http.foo",
"src":"client.ip",
"name":"testheader",
"version":"1",
"service_id":"SU1Z0isxPaozGVKXdv0eY",
"priority":"10"
},
...
]
POST /service/service_id/version/version/header

Creates a new Header object.

Authentication

key_or_engineer

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/header
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
name=testheader&type=request&action=set&dst=http.foo&src=client.ip&ignore_if_set=0&priority=10
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"ignore_if_set":"0",
"type":"request",
"action":"set",
"substitution":"",
"response_condition":null,
"cache_condition":null,
"request_condition":null,
"regex":"",
"dst":"http.foo",
"src":"client.ip",
"name":"testheader",
"version":"1",
"service_id":"SU1Z0isxPaozGVKXdv0eY",
"priority":"10"
}
DELETE /service/service_id/version/version/header/name

Deletes a Header object by name.

Authentication

key_or_engineer

Request Example
DELETE /service/SU1Z0isxPaozGVKXdv0eY/version/1/header/testheader
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"status":"ok"
}
PUT /service/service_id/version/version/header/old_name

Modifies an existing Header object by name.

Authentication

key_or_engineer

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/header/testheader
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
name=testheader&type=request&action=set&dst=http.foo&src=client.ip&ignore_if_set=0&priority=10
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"ignore_if_set":"0",
"type":"request",
"action":"set",
"substitution":"",
"response_condition":null,
"cache_condition":null,
"request_condition":null,
"regex":"",
"dst":"http.foo",
"src":"client.ip",
"name":"testheader",
"version":"1",
"service_id":"SU1Z0isxPaozGVKXdv0eY",
"priority":"10"
}

Healthcheck

Healthchecks are used to customize the way Fastly checks on your Backends. Only Backends that have successful Healthchecks will be sent traffic, thus assuring that the failure of one server does not affect visitors.

Fields

Actions

GET /service/service_id/version/version/healthcheck/name

Get the healthcheck for a particular service and version

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/healthcheck/test-healthcheck
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"name": "test-healthcheck",
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version": "1",
"method": "HEAD",
"host": "example.com",
"path": "/robots.txt",
"http_version": "1.1",
"timeout": "0.5",
"window": "5",
"threshold": "3",
"check_interval":"1",
"expected_response":"200",
"initial":"2",
"comment":""
}
GET /service/service_id/version/version/healthcheck

List all of the healthchecks for a particular service and version

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/healthcheck
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"name": "test-healthcheck",
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version": "1",
"method": "HEAD",
"host": "example.com",
"path": "/robots.txt",
"http_version": "1.1",
"timeout": "0.5",
"window": "5",
"threshold": "3",
"check_interval":"1",
"expected_response":"200",
"initial":"2",
"comment":""
}
]
POST /service/service_id/version/version/healthcheck

Create a healthcheck for a particular service and version

Authentication

key_or_engineer

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/healthcheck
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencod
Accept: application/json
id=test-healthcheck&host=example.com&path=/robots.txt
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"name": "test-healthcheck",
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version": "1",
"method": "HEAD",
"host": "example.com",
"path": "/robots.txt",
"http_version": "1.1",
"timeout": "0.5",
"window": "5",
"threshold": "3",
"check_interval":"1",
"expected_response":"200",
"initial":"2",
"comment":""
}
DELETE /service/service_id/version/version/healthcheck/name

Delete the healthcheck for a particular service and version

Authentication

key_or_engineer

Request Example
DELETE /service/SU1Z0isxPaozGVKXdv0eY/version/1/healthcheck/test-healthcheck
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"status":"ok"
}
PUT /service/service_id/version/version/healthcheck/old_name

Update the healthcheck for a particular service and version

Authentication

key_or_engineer

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/healthcheck/test-healthcheck
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencode
Accept: application/json
id=updated-healthcheck
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"name": "updated-healthcheck",
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version": "1",
"method": "HEAD",
"host": "example.com",
"path": "/robots.txt",
"http_version": "1.1",
"timeout": "0.5",
"window": "5",
"threshold": "3",
"check_interval":"1",
"expected_response":"200",
"initial":"2",
"comment":""
}

Request Settings

Settings used to customize Fastly's request handling. When used with Conditions the Request Settings object allows you to fine tune how specific types of requests are handled.

Fields

Actions

GET /service/service_id/version/version/request_settings/name

Gets the specified Request Settings object.

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/request_settings/testrequest
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"hash_keys":null,
"action":"lookup",
"xff":"append",
"force_miss":"0",
"request_condition":"",
"timer_support":"0",
"force_ssl":"1",
"geo_headers":"1",
"name":"testrequest",
"bypass_busy_wait":"0",
"version":"6",
"default_host":"website.com",
"service_id":"SU1Z0isxPaozGVKXdv0eY",
"max_stale_age":"60"
}
GET /service/service_id/version/version/request_settings

Returns a list of all Request Settings objects for the given service and version.

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/request_settings
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"hash_keys":null,
"action":"lookup",
"xff":"append",
"force_miss":"0",
"request_condition":"",
"timer_support":"0",
"force_ssl":"1",
"geo_headers":"1",
"name":"testrequest",
"bypass_busy_wait":"0",
"version":"6",
"default_host":"website.com",
"service_id":"SU1Z0isxPaozGVKXdv0eY",
"max_stale_age":"60"
}
]
POST /service/service_id/version/version/request_settings

Creates a new Request Settings object.

Authentication

key_or_engineer

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/request_settings
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
hash_keys=null&action=lookup&xff=append&force_miss=0&timer_support=0&force_ssl=1&geo_headers=1&name=testrequest&bypass_busy_wait=0&max_stale_age=60
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"hash_keys":null,
"action":"lookup",
"xff":"append",
"force_miss":"0",
"request_condition":"",
"timer_support":"0",
"force_ssl":"1",
"geo_headers":"1",
"name":"testrequest",
"bypass_busy_wait":"0",
"version":"6",
"default_host":"website.com",
"service_id":"SU1Z0isxPaozGVKXdv0eY",
"max_stale_age":"60"
}
DELETE /service/service_id/version/version/request_settings/name

Removes the specfied Request Settings object.

Authentication

key_or_engineer

Request Example
DELETE /service/SU1Z0isxPaozGVKXdv0eY/version/1/request_settings/testrequest
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"status":"ok"
}
PUT /service/service_id/version/version/request_settings/old_name

Updates the specified Request Settings object.

Authentication

key_or_engineer

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/request_settings/testrequest
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
hash_keys=null&action=lookup&xff=append&force_miss=0&timer_support=0&force_ssl=1&geo_headers=1&name=testrequest&bypass_busy_wait=0&max_stale_age=60
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"hash_keys":null,
"action":"lookup",
"xff":"append",
"force_miss":"0",
"request_condition":"",
"timer_support":"0",
"force_ssl":"1",
"geo_headers":"1",
"name":"testrequest",
"bypass_busy_wait":"0",
"version":"6",
"default_host":"website.com",
"service_id":"SU1Z0isxPaozGVKXdv0eY",
"max_stale_age":"60"
}

Response Object

Allows you to create synthetic responses that exist entirely on the varnish machine. Useful for creating error or maintainence pages that exists outside the scope of your datacenter. Best when used with Condition objects.

Fields

Actions

GET /service/service_id/version/version/response_object/name

Gets the specified Response Object.

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/response_object/testresponse
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"status":"200",
"response":"Ok",
"cache_condition":"",
"request_condition":"",
"name":"testresponse",
"version":"1",
"content":"this message means all is okay",
"content_type":"text/plain",
"service_id":"SU1Z0isxPaozGVKXdv0eY"
}
GET /service/service_id/version/version/response_object

Returns all Response Objects for the specified service and version.

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/response_object
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"status":"200",
"response":"Ok",
"cache_condition":"",
"request_condition":"",
"name":"testresponse",
"version":"1",
"content":"this message means all is okay",
"content_type":"text/plain",
"service_id":"SU1Z0isxPaozGVKXdv0eY"
}
]
POST /service/service_id/version/version/response_object

Creates a new Response Object.

Authentication

key_or_engineer

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/response_object
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
status=200&response=Ok&name=testresponse&content=this+message+means+all+is+okay
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"status":"200",
"response":"Ok",
"cache_condition":"",
"request_condition":"",
"name":"testresponse",
"version":"1",
"content":"this message means all is okay",
"content_type":"text/plain",
"service_id":"SU1Z0isxPaozGVKXdv0eY"
}
DELETE /service/service_id/version/version/response_object/name

Deletes the specified Response Object.

Authentication

key_or_engineer

Request Example
DELETE /service/SU1Z0isxPaozGVKXdv0eY/version/1/response_object/testresponse
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"status":"ok"
}
PUT /service/service_id/version/version/response_object/old_name

Updates the specified Response Object.

Authentication

key_or_engineer

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/response_object/testresponse
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
status=200&response=Ok&name=testresponse&content=this+message+means+all+is+okay
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"status":"200",
"response":"Ok",
"cache_condition":"",
"request_condition":"",
"name":"testresponse",
"version":"1",
"content":"this message means all is okay",
"content_type":"text/plain",
"service_id":"SU1Z0isxPaozGVKXdv0eY"
}

Service

A Service represents the configuration for a website, app, api, or anything else to be served through Fastly. A Service can have many Versions, through which Backends, Domains, and more can be configured.

Fields

Actions

GET /service

List Services

Authentication

key

Request Example
GET /service
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"id":"SU1Z0isxPaozGVKXdv0eY",
"name":"test-service",
"customer_id":"hTE5dRlSBICGPJxJwCH4M",
"comment":"updating this service",
"active_version":"2",
"versions":[
{
"number":"1",
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"testing":null,
"staging":null,
"locked":"0",
"active":null,
"deployed":null,
"deleted_at":null,
"comment":"no comment",
"service":"z21h0iBxsaozGVKXdv0xY",
"updated_at":"2012-06-14T22:32:02",
"created_at":"2012-06-14T22:32:02"
},
...
]
}
]
GET /service/id/details

List detailed information on a specified service

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/details
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"id":"SU1Z0isxPaozGVKXdv0eY",
"name":"test-service",
"customer_id":"hTE5dRlSBICGPJxJwCH4M",
"comment":"updating this service",
"updated_at":"2012-06-14T21:20:19+00:00",
"created_at":"2012-06-14T21:20:19+00:00",
"publish_key":"xgdbdd93h5066f8d330c276fDe00f9d293abfex7",
"versions":[
{
"number":"1",
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"testing":null,
"staging":null,
"locked":"0",
"active":null,
"deployed":null,
"deleted_at":null,
"comment":"no comment",
"service":"z21h0iBxsaozGVKXdv0xY",
"updated_at":"2012-06-14T22:32:02",
"created_at":"2012-06-14T22:32:02",
"backend":1
},
...
]
}
GET /service/search

Get a specific service by name

Authentication

key_or_engineer

Request Example
GET /service/search?name=test-service
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"id":"SU1Z0isxPaozGVKXdv0eY",
"name":"test-service",
"customer_id":"hTE5dRlSBICGPJxJwCH4M",
"comment":"updating this service",
"versions":[
{
"number":"1",
"backend":[...],
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"testing":null,
"staging":null,
"locked":"0",
"active":null,
"deployed":null,
"comment":"",
"updated":"2012-06-14T22:32:02",
"deleted":"2012-06-14T22:32:02",
"condition":[...],
"healthcheck":[...],
"cache-settings":[...],
"origin":[...],
"director":[...],
"wordpress":[...],
"vcl":[...],
"logging_syslog":[...],
"response_object":[...],
"ssl":[...],
"domain":[...],
"header":[...],
"match":[...],
"request_settings":[...],
}
]
}
GET /service/id

Get a specific service by id

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"id":"SU1Z0isxPaozGVKXdv0eY",
"name":"test-service",
"customer_id":"hTE5dRlSBICGPJxJwCH4M",
"comment":"updating this service"
"publish_key":"hTE5dRlSBICGPJxJwCH4M,
"created_at":"2012-06-14T21:20:19+00:00",
"updated_at":"2012-06-14T21:20:19+00:00",
"versions":[
{
"number":"1",
"backend":0,
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"testing":null,
"staging":null,
"locked":"0",
"active":null,
"deployed":null,
"comment":"",
"deleted_at":null,
"service":"z21h0iBxsaozGVKXdv0xY",
"created_at":"2012-06-14T21:20:19+00:00",
"updated_at":"2012-06-14T21:20:19+00:00"
},
...
]
}
POST /service

Create a service

Authentication

key_or_engineer

Request Example
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
name=test-service
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"id":"SU1Z0isxPaozGVKXdv0eY",
"name":"test-service",
"customer_id":"hTE5dRlSBICGPJxJwCH4M",
"comment":"updating this service"
"publish_key":"hTE5dRlSBICGPJxJwCH4M,
"created_at":"2012-06-14T21:20:19+00:00",
"updated_at":"2012-06-14T21:20:19+00:00",
"versions":[
{
"number":"1",
"backend":0,
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"testing":null,
"staging":null,
"locked":"0",
"active":null,
"deployed":null,
"comment":"",
"deleted_at":null,
"service":"z21h0iBxsaozGVKXdv0xY",
"created_at":"2012-06-14T21:20:19+00:00",
"updated_at":"2012-06-14T21:20:19+00:00"
}
]
}
DELETE /service/id

Delete a service

Authentication

key_or_engineer

Request Example
DELETE /service/SU1Z0isxPaozGVKXdv0eY
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"status":"ok"
}
PUT /service/id

Update a service

Authentication

key_or_engineer

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
name=updated-service-name
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"id":"SU1Z0isxPaozGVKXdv0eY",
"name":"updated-service-name",
"customer_id":"hTE5dRlSBICGPJxJwCH4M",
"comment":"updating this service"
"publish_key":"hTE5dRlSBICGPJxJwCH4M",
"created_at":"2012-06-14T21:20:19+00:00",
"updated_at":"2012-06-14T21:20:19+00:00",
"versions":[
{
"number":"1",
"backend":0,
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"testing":null,
"staging":null,
"locked":"0",
"active":null,
"deployed":null,
"comment":"",
"deleted_at":null,
"service":"z21h0iBxsaozGVKXdv0xY",
"created_at":"2012-06-14T21:20:19+00:00",
"updated_at":"2012-06-14T21:20:19+00:00"
}
]
}
GET /service/id/domain

List the domains within a service

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/domain
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"name":"domain1",
"version":"2",
"service_id":"SU1Z0isxPaozGVKXdv0eY",
"comment":"the first domain"
}
]

Settings

Handles default settings for a particular version of a service.

Fields

Actions

GET /service/service_id/version/version/settings

Get the settings for a particular service and version

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/3/settings
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version": "3",
"general.default_ttl": 3600,
"general.default_host": "www.mydomain.com"
}
PUT /service/service_id/version/version/settings

Update the settings for a particular service and version

Authentication

key_or_engineer

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/3/settings
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
general.default_ttl=4242&general.default_host=www.mydomain.com
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version": "3",
"general.default_ttl": 4242,
"general.default_host": "www.mydomain.com"
}

Stats

Stats give you information on the usage and performance of your Service. They can be request by Service and over a particular time span. Stats are broken down per datacenter, giving you information on how your Services are being used across the world. There is now a more flexible, and fully featured Stats API available

Fields

Actions

GET /service/service/stats/summary

Get the stats from a service for a block of time. This call requires parameters to select block of time to query. Use either a timestamp range (using start_time and end_time) or a specified month/year combo (using month and year)

Authentication

key

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/stats/summary?year=2013&month=7
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"ASH":
{
"hits":9349817,
"body_size":8803179494,
"miss":43946,
"requests":9396741,
"pass":362,
"header_size":3046479390
},
"LON":
{
"hits":7770636,
"body_size":15461547572,
"miss":33386,
"requests":7806494,
"pass":158,
"header_size":2514026350
},
...
}
GET /service/service/stats/type

Get the stats from a service. This call is deprecated. Please use the summary call above. If type is either of "all" or "minutely", you must use specify a block of time using the fields above

Authentication

key

Parameters

  • type - granularity of stats requested. one of: all, minutely, hourly, daily

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/stats/daily
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"ASH":
{
"hits":9349817,
"body_size":8803179494,
"miss":43946,
"requests":9396741,
"pass":362,
"header_size":3046479390
},
"LON":
{
"hits":7770636,
"body_size":15461547572,
"miss":33386,
"requests":7806494,
"pass":158,
"header_size":2514026350
},
...
}

VCL

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

Fields

Actions

GET /service/service_id/version/version/vcl

List the uploaded VCLs for a particular service and version

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/vcl?include_content=1
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version": "1",
"main": true,
"name": "test-vcl",
"content": "backend default {\n .host = \"127.0.0.1\";\n .port = \"9092\";\n}\n\nsub vcl_recv {\n set req.backend = default;\n}\n\nsub vcl_hash {\n set req.hash += req.url;\n set req.hash += req.http.host;\n set req.hash += \"0\";\n}"
}
]
GET /service/service_id/version/version/vcl/name

Get the uploaded VCL for a particular service and version

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/vcl/test-vcl?include_content=1
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version": "1",
"main": true,
"name": "test-vcl",
"content": "backend default {\n .host = \"127.0.0.1\";\n .port = \"9092\";\n}\n\nsub vcl_recv {\n set req.backend = default;\n}\n\nsub vcl_hash {\n set req.hash += req.url;\n set req.hash += req.http.host;\n set req.hash += \"0\";\n}"
}
GET /service/service_id/version/version/vcl/name/content

Get the uploaded VCL for a particular service and version with HTML syntax highlighting

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/vcl/test-vcl/content
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"content": "
  backend default {\n    .host = "127.0.0.1";\n    .port = "80";\n  }\n  \n  sub vcl_recv {\n      set req.backend = default;\n  }\n  \n  sub vcl_hash {\n      set req.hash += req.url;\n      set req.hash += req.http.host;\n      set req.hash += "0";\n  }\n
\n"
}
GET /service/service_id/version/version/vcl/name/download

Download the specified VCL

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/vcl/test-vcl/download
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"backend default {\n .host = \"127.0.0.1\";\n .port = \"9093\";\n}\n\nsub vcl_recv {\n set req.backend = default;\n}\n\nsub vcl_hash {\n set req.hash += req.url;\n set req.hash += req.http.host;\n set req.hash += \"0\";\n}"
}
GET /service/service_id/version/version/generated_vcl

Display the generated VCL for a particular service and version

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/generated_vcl
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version": "1",
"main": false,
"name": "test-vcl",
"content": "backend default {\n .host = \"127.0.0.1\";\n .port = \"9093\";\n}\n\nsub vcl_recv {\n set req.backend = default;\n}\n\nsub vcl_hash {\n set req.hash += req.url;\n set req.hash += req.http.host;\n set req.hash += \"0\";\n}"
}
GET /service/service_id/version/version/generated_vcl/content

Display the content of generated VCL with HTML syntax highlighting

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/generated_vcl/content
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"content": "
  backend default {\n    .host = "127.0.0.1";\n    .port = "80";\n  }\n  \n  sub vcl_recv {\n      set req.backend = default;\n  }\n  \n  sub vcl_hash {\n      set req.hash += req.url;\n      set req.hash += req.http.host;\n      set req.hash += "0";\n  }\n
\n"
}
POST /service/service_id/version/version/vcl

Upload a VCL for a particular service and version

Authentication

key_or_engineer

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/vcl
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
name=test-vcl&content=
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version": "1",
"main": false,
"name": "test-vcl",
"content": "backend default {\n .host = \"127.0.0.1\";\n .port = \"9092\";\n}\n\nsub vcl_recv {\n set req.backend = default;\n}\n\nsub vcl_hash {\n set req.hash += req.url;\n set req.hash += req.http.host;\n set req.hash += \"0\";\n}"
}
DELETE /service/service_id/version/version/vcl/name

Delete the uploaded VCL for a particular service and version

Authentication

key_or_engineer

Request Example
DELETE /service/SU1Z0isxPaozGVKXdv0eY/version/1/vcl/test-vcl
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"status":"ok"
}
PUT /service/service_id/version/version/vcl/name/main

Set the specified VCL as the main

Authentication

key_or_engineer

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/vcl/test-vcl/main
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version": "1",
"main": true,
"name": "test-vcl",
"content": "backend default {\n .host = \"127.0.0.1\";\n .port = \"9092\";\n}\n\nsub vcl_recv {\n set req.backend = default;\n}\n\nsub vcl_hash {\n set req.hash += req.url;\n set req.hash += req.http.host;\n set req.hash += \"0\";\n}"
}
PUT /service/service_id/version/version/vcl/old_name

Update the uploaded VCL for a particular service and version

Authentication

key_or_engineer

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/vcl/test-vcl
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
content=
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version": "1",
"main": true,
"name": "test-vcl",
"content": "backend default {\n .host = \"127.0.0.1\";\n .port = \"9093\";\n}\n\nsub vcl_recv {\n set req.backend = default;\n}\n\nsub vcl_hash {\n set req.hash += req.url;\n set req.hash += req.http.host;\n set req.hash += \"0\";\n}"
}

Version

A Version represents a specific instance of the configuration for a Service. A Version can be cloned, locked, activated, or deactivated.

Fields

Actions

GET /service/service_id/version/number

Get the version for a particular service

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/2
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"number":2,
"service_id": "SU1Z0isxPaozGVKXdv0eY"
"network"{
"name":"johnnetwork",
"description":"john's network",
"available_all":"yes",
"available_restricted":"no",
"available_private":"no",
"customer":"d3cafb4dde4dbeef"
},
"comment":"this is a service",
"testing":"false",
"staging":"true",
"deployed":"true",
"active":"true",
"locked":"false"
}
POST /service/service_id/version

Create a version for a particular service

Authentication

key_or_engineer

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
service=SU1Z0isxPaozGVKXdv0eY
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"number":2,
"service_id": "SU1Z0isxPaozGVKXdv0eY"
"network"{
"name":"johnnetwork",
"description":"john's network",
"available_all":"yes",
"available_restricted":"no",
"available_private":"no",
"customer":"d3cafb4dde4dbeef"
},
"comment":"this is a service",
"testing":"false",
"staging":"true",
"deployed":"true",
"active":"true",
"locked":"false"
}
GET /service/service_id/version

List the versions for a particular service

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"number":2,
"service_id": "SU1Z0isxPaozGVKXdv0eY"
"network"{
"name":"johnnetwork",
"description":"john's network",
"available_all":"yes",
"available_restricted":"no",
"available_private":"no",
"customer":"d3cafb4dde4dbeef"
},
"comment":"this is a service",
"testing":"false",
"staging":"true",
"deployed":"true",
"active":"true",
"locked":"false"
}
]
PUT /service/service_id/version/number

Update a particular version for a particular service

Authentication

key_or_engineer

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/2
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"number":2,
"service_id": "SU1Z0isxPaozGVKXdv0eY"
"network"{
"name":"johnnetwork",
"description":"john's network",
"available_all":"yes",
"available_restricted":"no",
"available_private":"no",
"customer":"d3cafb4dde4dbeef"
},
"comment":"this is a service",
"testing":"false",
"staging":"true",
"deployed":"true",
"active":"true",
"locked":"false"
}
PUT /service/service_id/version/number/activate

Activate the current version

Authentication

key_or_engineer

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/3/activate
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version":"3",
"locked":0,
"active":1
}
PUT /service/service_id/version/number/deactivate

Deactivate the current version

Authentication

key_or_engineer

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/3/deactivate
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"service_id": "SU1Z0isxPaozGVKXdv0eY",
"version":"3",
"locked":0,
"active":0
}
PUT /service/service_id/version/number/clone

Clone the current configuration into a new version

Authentication

key_or_engineer

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/2/clone
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"number":3,
"service_id": "SU1Z0isxPaozGVKXdv0eY"
"network"{
"name":"johnnetwork",
"description":"john's network",
"available_all":"yes",
"available_restricted":"no",
"available_private":"no",
"customer":"d3cafb4dde4dbeef"
},
"comment":"this is a service",
"testing":"false",
"staging":"true",
"deployed":"true",
"active":"true",
"locked":"false"
}
GET /service/service_id/version/number/validate

Validate the version for a particular service and version

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/3
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"status":"ok"
}
PUT /service/service_id/version/number/lock

Locks the specified version

Authentication

key_or_engineer

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/2/clone
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"number":2,
"service_id": "SU1Z0isxPaozGVKXdv0eY"
"network"{
"name":"johnnetwork",
"description":"john's network",
"available_all":"yes",
"available_restricted":"no",
"available_private":"no",
"customer":"d3cafb4dde4dbeef"
},
"comment":"this is a service",
"testing":"false",
"staging":"true",
"deployed":"true",
"active":"true",
"locked":"true"
}

Wordpress

The WordPress object applies configuration optimized for WordPress to a given path.

Fields

Actions

GET /service/service_id/version/version/wordpress/name

Get information on a specific WordPress.

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/wordpress/testwordpress
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"comment":"",
"name":"testwordpress",
"version":"1",
"path":"/blog",
"service_id":"SU1Z0isxPaozGVKXdv0eY"
}
GET /service/service_id/version/version/wordpress

Get all of the WordPresses for a specified service and version.

Authentication

key_or_engineer

Request Example
GET /service/SU1Z0isxPaozGVKXdv0eY/version/1/wordpress
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"comment":"",
"name":"testwordpress",
"version":"1",
"path":"/blog",
"service_id":"SU1Z0isxPaozGVKXdv0eY"
},
...
]
POST /service/service_id/version/version/wordpress

Create a WordPress for the specified service and version.

Authentication

key_or_engineer

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/wordpress
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
name=testwordpress&path=/blog
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"comment":"",
"name":"testwordpress",
"version":"1",
"path":"/blog",
"service_id":"SU1Z0isxPaozGVKXdv0eY"
}
DELETE /service/service_id/version/version/wordpress/name

Delete a specified WordPress.

Authentication

key_or_engineer

Request Example
DELETE /service/SU1Z0isxPaozGVKXdv0eY/version/1/wordpress/testwordpress
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"status":"ok"
}
PUT /service/service_id/version/version/wordpress/old_name

Update a specified WordPress.

Authentication

key_or_engineer

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/wordpress/testwordpress
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
name=testwordpress&path=/blog
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"comment":"",
"name":"testwordpress",
"version":"1",
"path":"/blog",
"service_id":"SU1Z0isxPaozGVKXdv0eY"
}