Fastly Configuration API

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

  • name - The name of the Backend.
  • address - An IPv4, hostname, or IPv6 address for the Backend.
  • port - The port number.
  • use_ssl - Whether or not the use SSL to reach the backend.
  • connect_timeout - How long to wait for a timeout in milliseconds.
  • first_byte_timeout - How long to wait for the first bytes in milliseconds.
  • between_bytes_timeout - How long to wait between bytes in milliseconds.
  • error_threshold - Number of errors to allow before the backend is marked as down.
  • max_conn - Maximum number of connections.
  • weight - Weight used to load balance this backend against others.
  • auto_loadbalance - Whether or not this backend should be automatically load balanced.
  • request_condition - Condition, which if met, will select this backend during a request.
  • healthcheck - The Name of the healthcheck to use with this backend. Can be empty.

Actions

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

Get the backend for a particular service and version

Authentication

key

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

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/backend
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
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"
}
GET /service/service_id/version/version/backend

List all backends for a particular service and version

Authentication

key

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

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

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/backend/test-backend
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
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"
}

Billing

Get information on current and past bills.

Fields

  • start_time - The start date of this invoice.
  • end_time - The end date of this invoice.
  • status.status - What the current status of this invoice can be. One of Pending (being generated), Outstanding (unpaid), Paid (paid), Month to date (the current month)
  • status.sent_at - When the invoice was sent out (if Outstanding or Paid)
  • total.plan_name - The name of the plan this invoice was generated under.
  • total.plan_code - The short code the plan this invoice was generated under.
  • total.plan_minimum - The minimum cost of this plan.
  • total.bandwidth - The total amount of bandwidth used this month in Gb.
  • total.bandwidth_cost - The cost of the bandwidth used this month in USD.
  • total.requests - The total number of requests used this month.
  • total.requests_cost - The cost of the requests used this month.
  • total.incurred_cost - The total cost of bandwidth and requests used this month.
  • total.overage - How much over the plan minimum has been incurred.
  • total.extras - A list of any extras for this invoice.
  • total.extras.name - The name of this extra cost
  • total.extras.setup - Initital set up cost in USD (not present if $0.0 or this is not the month the extra was added).
  • total.extras.recurring - Recurring monthly cost in USD (not present if $0.0).
  • total.extras_cost - Total cost of all extras.
  • total.cost_before_discount - Total incurred cost plus extras cost.
  • total.discount - Calculated discount rate.
  • total.cost - The final amount to be paid.
  • total.terms - Payment terms. Almost always Net15.

Actions

GET /billing/year/year/month/month

Get the invoice for a given year and month.

Authentication

none

Request Example
GET /billing/year/2012/month/01
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
"invoice_id": "6xgTD77CFjVsa958dxMRIx",
"start_time": "2012-01-01T00:00:00Z",
"end_time": "2012-01-31T23:59:59Z",
"status": {
"status": "Outstanding",
"sent_at": "2012-02-01T00:26:07+00:00"
},
"total": {
"plan_name": "friends",
"plan_code": "friends",
"plan_minimum": 0.0,
"bandwidth": 149.4003043212,
"bandwidth_cost": 17.928036518544001,
"requests": 136350306.0,
"requests_cost": 102.5957181,
"incurred_cost": 120.523754618544,
"overage": 120.523754618544,
"extras": [
{
"name": "EV Certificate Hosting"
"setup": 0.0,
"recurring": 100.0,
}
],
"extras_cost": 100.0,
"cost_before_discount": 220.52375461854399,
"discount": 54.653411296675401,
"cost": 100.0,
"terms": "Net15"
},
"regions": {
"europe": {
"requests": {
"tiers": [
{
"units": 0.0,
"price": 0.012,
"total": 0.0,
"name": "per 10,000 HTTPS requests"
},
{
"units": 221.9924,
"price": 0.0089999999999999993,
"total": 1.9979316,
"name": "per 10,000 HTTP requests"
}
],
"total": 1.9979316
},
"cost": 3.1379692540795001,
"bandwidth": {
"tiers": [
{
"units": 9.5003137839958107,
"price": 0.12,
"total": 1.1400376540795001,
"name": "first 10TB"
}
],
"total": 1.1400376540795001
}
},
"australia": {
"requests": {
"tiers": [
{
"units": 0.0,
"price": 0.012,
"total": 0.0,
"name": "per 10,000 HTTPS requests"
},
{
"units": 0.0,
"price": 0.0089999999999999993,
"total": 0.0,
"name": "per 10,000 HTTP requests"
}
],
"total": 0.0
},
"cost": 0.0,
"bandwidth": {
"tiers": [
{
"units": 0.0,
"price": 1.0,
"total": 0.0,
"name": "first 10TB"
}
],
"total": 0.0
}
},
"asia": {
"requests": {
"tiers": [
{
"units": 0.0,
"price": 0.012,
"total": 0.0,
"name": "per 10,000 HTTPS requests"
},
{
"units": 0.0,
"price": 0.0089999999999999993,
"total": 0.0,
"name": "per 10,000 HTTP requests"
}
],
"total": 0.0
},
"cost": 0.0,
"bandwidth": {
"tiers": [
{
"units": 0.0,
"price": 1.0,
"total": 0.0,
"name": "first 10TB"
}
],
"total": 0.0
}
},
"usa": {
"requests": {
"tiers": [
{
"units": 0.0,
"price": 0.01,
"total": 0.0,
"name": "per 10,000 HTTPS requests"
},
{
"units": 13413.038200000001,
"price": 0.0074999999999999997,
"total": 100.5977865,
"name": "per 10,000 HTTP requests"
}
],
"total": 100.5977865
},
"cost": 117.385785364464,
"bandwidth": {
"tiers": [
{
"units": 139.89999053720399,
"price": 0.12,
"total": 16.787998864464502,
"name": "first 10TB"
}
],
"total": 16.787998864464502
}
}
},
"services": {
"CI2LkXSZslPkSEUkCxgt3": {
"europe": {
"requests": 37.0,
"ssl_requests": 0.0,
"bandwidth": 0.00020559784024953799
},
"australia": {
"requests": 0.0,
"ssl_requests": 0.0,
"bandwidth": 0.0
},
"name": "blog",
"usa": {
"requests": 218.0,
"ssl_requests": 0.0,
"bandwidth": 0.00049502775073051496
},
"asia": {
"requests": 0.0,
"ssl_requests": 0.0,
"bandwidth": 0.0
}
},
"1jlmtMz1ncwA0KC3TBGD0X": {
"europe": {
"requests": 59316.0,
"ssl_requests": 0.0,
"bandwidth": 0.24078979436308101
},
"australia": {
"requests": 0.0,
"ssl_requests": 0.0,
"bandwidth": 0.0
},
"name": "app",
"usa": {
"requests": 662713.0,
"ssl_requests": 0.0,
"bandwidth": 4.8184103155508602
},
"asia": {
"requests": 0.0,
"ssl_requests": 0.0,
"bandwidth": 0.0
}
}
}

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

  • name - Name for the cache settings object
  • action - Allows for termination of execution and either cache, pass, or restart
  • ttl - Sets the "Time To Live"
  • stale_ttl - Sets the max "Time To Live" for stale (unreachable) objects.
  • cache_condition - Name of the caondition used to test whether this settings object should be used.

Actions

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

Get a specific cache settings object.

Authentication

key

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

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

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/cache_settings
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
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"
}
DELETE /service/service_id/version/version/cache_settings/name

Delete a specific cache settings object.

Authentication

key

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

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/cache_settings/testcache
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
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

  • name - Name of the condition.
  • statement - The statement used to determine if the condition is met.
  • type - Type of the condition, either "REQUEST" (req), "RESPONSE" (req, resp), or "CACHE" (req, beresp).
  • priority - Used to determine the priority in which conditions are checked.

Actions

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

Gets the specified condition.

Authentication

key

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

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

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/condition
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
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"
}
DELETE /service/service_id/version/version/condition/name

Deletes the specified condition.

Authentication

key

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

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/condition/testcondition
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
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"
}

Content

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

Fields

Actions

GET /content/edge_check

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

Authentication

none

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
}
],
...
]

Customer

A Customer is the base object which owns your Users and Services

Fields

  • name - The name of the customer, generally the company name.
  • pricing_plan - The pricing plan this customer is under.
  • can_configure_wordpress - Whether this customer can edit wordpress. Read Only.
  • can_reset_passwords - Whether this customer can reset passwords. Read Only.
  • can_stream_syslog - Whether this customer can stream syslogs. Read Only.
  • can_upload_vcl - Whether this customer can upload VCL. Read Only.
  • has_config_panel - Whether this customer has a configuration panel. Read Only.

Actions

GET /current_customer

Get the logged in customer

Authentication

key

Request Example
GET /current_customer
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"can_stream_syslog":null,
"owner_id":"x9KzsrACXZv8tPwlEDsKb6",
"can_upload_vcl":null,
"has_config_panel":null,
"raw_api_key":"nb35eRl123CGPJxJwCH4g"
"name":"Test Account",
"id":"hTE5dRlSBICGPJxJwCH4M",
"can_configure_wordpress":null,
"updated_at":"2012-06-16T20:50:45+00:00",
"created_at":"2008-06-16T05:25:30+00:00",
"can_reset_passwords":true,
"pricing_plan":"customer",
"billing_contact_id":null
}
GET /customer/id

Get a specific customer

Authentication

session

Request Example
GET /customer/hTE5dRlSBICGPJxJwCH4M
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"can_stream_syslog":null,
"owner_id":"x9KzsrACXZv8tPwlEDsKb6",
"can_upload_vcl":null,
"has_config_panel":null,
"raw_api_key":"nb35eRl123CGPJxJwCH4g"
"name":"Test Account",
"id":"hTE5dRlSBICGPJxJwCH4M",
"can_configure_wordpress":null,
"updated_at":"2012-06-16T20:50:45+00:00",
"created_at":"2008-06-16T05:25:30+00:00",
"can_reset_passwords":true,
"pricing_plan":"customer",
"billing_contact_id":null
}
PUT /customer/id

Update a customer

Authentication

session

Request Example
PUT /customer/4mp6jxt8Z5b4be5jIhXz0O
Content-Type: application/x-www-form-urlencoded
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"can_stream_syslog":null,
"owner_id":"x9KzsrACXZv8tPwlEDsKb6",
"can_upload_vcl":null,
"has_config_panel":null,
"raw_api_key":"nb35eRl123CGPJxJwCH4g"
"name":"Test Account",
"id":"hTE5dRlSBICGPJxJwCH4M",
"can_configure_wordpress":null,
"updated_at":"2012-06-16T20:50:45+00:00",
"created_at":"2008-06-16T05:25:30+00:00",
"can_reset_passwords":true,
"pricing_plan":"customer",
"billing_contact_id":null
}
GET /customer/id/users

List all users from a specified customer id

Authentication

session

Request Example
get /customer/4mp6jxt8Z5b4be5jIhXz0O/users
Content-Type: application/x-www-form-urlencoded
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"login":"johnowner@website.com",
"name":"John",
"id":"x9KzsrACXZv8tPwlEDsKb6",
"updated_at":"2012-06-20T21:52:44+00:00",
"created_at":"2012-06-20T21:52:44+00:00",
"role":"admin",
"require_new_password":false,
"customer_id":"nb35eRl123CGPJxJwCH4g",
"email_hash":"hTE5dRlSBICGPJxJwCH4M"
}
]
DELETE /customer/id

Delete a customer

Authentication

session

Request Example
DELETE /customer/4mp6jxt8Z5b4be5jIhXz0O
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"status":"ok"
}

Diff

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

Fields

  • format - the format the diff is being returned in (text, html or html_simple)
  • from - the version number being diffed from
  • to - the version number being diffed to
  • diff - the differences between the two versions

Actions

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

Get diff between two versions

Authentication

key

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

  • name - Name for the Director.
  • quorum - The percentage of capacity that needs to be up for a director to be considered up. Integer, 0 to 100 (default: 75)
  • type - What type of load balance group to use. Integer, 1 to 4. Values: 1=random, 2=round-robin, 3=hash, 4=client. (default: 1)
  • retries - How many backends to search if it fails. (default: 5)

Actions

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

Get the director for a particular service and version

Authentication

key

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

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

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/director
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
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",
"capacity", "100"
}
DELETE /service/service_id/version/version/director/name

Delete the director for a particular service and version

Authentication

key

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

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/director/test-director
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
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

  • director - Name of the director.
  • backend - Name of the backend to map to the specified director.

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

none

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

none

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

none

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.

Fields

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

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

  • name - The domain that this service will respond to
  • comment - A personal freeform descriptive note

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

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

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

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

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/domain
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
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
}
GET /service/service_id/version/version/domain

List the domains for a particular service and version

Authentication

key

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

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

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

Event_log

EventLogs keep track of things that occur within your services or organization. Currently we track events such as activation and deactivation of Versions and mass purges. In the future we intend to track more events and let you trigger EventLog creation as well.

Fields

  • object_type - The type of object this message is for. (Ex: service, user, etc.)
  • id - The id of the object to which this log message applies.
  • message - A brief string explaining the event.
  • details - A more verbose explanation of the event.
  • level - An integer defining how serious the event is. Lower is more serious.
  • timestamp - A unix timestamp of when the event occurred.
  • system - Unused.
  • subsystem - Unused.

Actions

GET /event_log/id

Get the specified event log

Authentication

key

Request Example
GET /event_log/SU1Z0isxPaozGVKXdv0eY
Fastly-Key: YourAPIKey
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"level":5,
"message":"Activated version 2",
"details":"",
"timestamp":1339713014104,
"id":"SU1Z0isxPaozGVKXdv0eY",
"subsystem":"",
"system":"",
"object_type":"service"
}
]

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

  • name - A handle to refer to this Header object
  • action -
  • 'set' - - Sets (or resets) a header
  • 'append' - - Appends to an existing header
  • 'delete' - - Delete a header
  • 'regex' - - Perform a single regex replacement on a header
  • 'regex_repeat' - - Perform a global regex replacement on a header
  • ignore_if_set - Don't add the header if it is already. (Only applies to 'set' action.)
  • type -
  • 'request' - - Performs on the request before lookup occurs
  • 'fetch' - - Performs on the request to the origin server
  • 'cache' - - Performs on the response before it's stored in the cache
  • 'response' - - Performs on the response before delivering to the client
  • dst - Header to set
  • src - Variable to be used as a source for the header content (Does not apply to 'delete' action.)
  • regex - Regular expression to use (Only applies to 'regex' and 'regex_repeat' actions.)
  • substitution - Value to substitute in place of regular expression. (Only applies to 'regex' and 'regex_repeat'.)
  • priority - Lower priorities execute first. (Default: 100.)
  • request_condition - Optional name of a RequestCondition to apply.
  • cache_condition - Optional name of a CacheCondition to apply.
  • response_condition - Optional name of a ResponseCondition to apply.

Actions

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

Retrieves a Header object by name.

Authentication

key

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

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

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/header
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
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"
}
DELETE /service/service_id/version/version/header/name

Deletes a Header object by name.

Authentication

key

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

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/header/testheader
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
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"
}

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

  • name - The name of the healthcheck.
  • method - Which HTTP method to use.
  • host - Which host to check.
  • path - The path to check.
  • http_version - Whether to use version 1.0 or 1.1 HTTP.
  • timeout - Timeout in milliseconds.
  • check_interval - How often to run the healthcheck in milliseconds.
  • expected_response - The status code expected from the host.
  • window - The number of most recent healthcheck queries to keep for this healthcheck.
  • threshold - How many healthchecks must succeed to be considered healthy.
  • initial - When loading a config, the initial number of probes to be seen as OK.

Actions

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

Get the healthcheck for a particular service and version

Authentication

key

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

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

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/healthcheck
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencod
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":""
}
DELETE /service/service_id/version/version/healthcheck/name

Delete the healthcheck for a particular service and version

Authentication

key

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

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/healthcheck/test-healthcheck
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencode
Accept: application/json
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":""
}

Invitation


Fields

Actions

GET /invitation

Get all invitations created by the customer

Authentication

session

Request Example
GET /invitation
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"id":89j4t7s98e4e7tsjeg5s45h
"email":"john@website.com",
"status_code":1
},
{
"id":g944td0dfeeextx1xg5x25x
"email":"bob@website.com",
"status_code":0
"status_code":0
"status_code":0
"status_code":0
},
...
]
POST /invitation

Create a new invitation and email it to the recipient.

Authentication

session

Request Example
POST /invitation
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"id":89j4t7s98e4e7tsjeg5s45h
"email":"john@website.com",
"status_code":1
"status_code":0
"status_code":0
"status_code":0
},
PUT /invitation/id/cancel

Cancel an open invitation

Authentication

session

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

Pricing_extras

An object describing various extras that get added to your bill at the end of the month

Fields

  • name - The unique name of the pricing extra
  • setup - The setup cost of the pricing extra, only charged the month it was created
  • recurring - The recurring cost of the pricing extra, charged every month

Actions

GET /customer/customer_id/pricing_extra

Get all the pricing extras for a customer

Authentication

key

Request Example
GET /customer/hTE5dRlSBICGPJxJwCH4M/pricing_extra
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
[
{
"comment": null,
"customer_id": "hTE5dRlSBICGPJxJwCH4M",
"name": "SSL",
"setup": "500.0",
"deleted_at": null,
"recurring": "100.0",
"created_at": "2012-03-21T15:28:48-07:00"
},
{
"comment": null,
"customer_id": "hTE5dRlSBICGPJxJwCH4M",
"name": "Platinum Support",
"setup": "",
"deleted_at": null,
"recurring": "100.0",
"created_at": "2012-03-21T15:35:28-07:00"
}
GET /customer/customer_id/pricing_extra/name

Get an individual pricing extra for a customer

Authentication

key

Request Example
GET /customer/hTE5dRlSBICGPJxJwCH4M/pricing_extra/SSL
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
"comment": null,
"customer_id": "hTE5dRlSBICGPJxJwCH4M",
"name": "SSL",
"setup": "500.0",
"deleted_at": null,
"recurring": "100.0",
"created_at": "2012-03-21T15:28:48-07:00"

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

  • name - Name for the request settings.
  • force_miss - Allows you to force a cache miss for the request. Replaces the item in the cache if the content is cacheable
  • force_ssl - Forces the request use SSL (redirects a non-SSL to SSL)
  • action - Allows you to terminate request handling and immediately perform an action. When set it can be lookup or pass (ignore the cache completely)
  • bypass_busy_wait - Disable collapsed forwarding, so you don't wait for other objects to origin
  • max_stale_age - How old an object is allowed to be to serve stale-if-error or statel-while-revalidate
  • hash_keys - Comma separated list of varnish request object fields that should be in the hash key
  • xff - X-Forwarded-For -- should be clear, leave, append, append_all, or overwrite
  • timer_support - Injects the X-Timer info into the request for viewing origin fetch durations
  • geo_headers - Injects Fastly-Geo-Country, Fastly-Geo-City, and Fastly-Geo-Region into the request headers
  • default_host - Sets the host header
  • request_condition - Name of condition object used to test whether or not these settings should be used.

Actions

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

Gets the specified Request Settings object.

Authentication

key

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

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

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/request_settings
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
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"
}
DELETE /service/service_id/version/version/request_settings/name

Removes the specfied Request Settings object.

Authentication

key

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

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/request_settings/testrequest
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
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"
}

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

  • name - Name that identifies the Response Object
  • status - The HTTP Status Code, defaults to 200.
  • response - The HTTP Response, defaults to "Ok"
  • content - The content to deliver for the response object, can be empty.
  • content_type - The MIME type of the content, can be empty.
  • request_condition - Name of the condition to be checked during the request phase. If the condition passes then this object will be delivered.
  • cache_condition - Name of the condition checked after we have retrieved an object. If the condition passes then deliver this Request Object instead.

Actions

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

Gets the specified Response Object.

Authentication

key

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

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

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/response_object
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
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"
}
DELETE /service/service_id/version/version/response_object/name

Deletes the specified Response Object.

Authentication

key

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

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/response_object/testresponse
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
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"
}

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

  • name - The name of this service.
  • customer_id - Which customer this service belongs to.
  • publish_key - What key to use for the publish streams.
  • versions - A list of versions associated with this service.

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

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

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

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

Request Example
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
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"
}
]
}
DELETE /service/id

Delete a service

Authentication

key

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

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
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

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

  • general.default_ttl - The default Time-to-live (TTL) for the version.
  • general.default_host - The default host name for the version.

Actions

GET /service/service_id/version/version/settings

Get the settings for a particular service and version

Authentication

key

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

Request Example
PUT /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": 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

  • start_time - epoch timestamp for period request
  • end_time - epoch timestamp for period request
  • year - summarize a specific Y/M (requires month)
  • month - summarize a specific month (requires year)

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

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
},
...
}

User

A User of the Fastly administration panel. A User is always associated with a Customer.

Fields

  • login - The email address, which is the login name, of this user.
  • name - The real life name of the user.
  • role - The role of this user.

Actions

POST /current_user/password

Update the user's password to a new one

Authentication

session

Request Example
POST /current_user/password/newpwd
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"login":"johnowner@website.com",
"name":"John Owner",
"id":"x9KzsrACXZv8tPwlEDsKb6",
"updated_at":"2012-06-21T03:22:50+00:00",
"created_at":"2012-06-20T21:52:44+00:00",
"role":"admin",
"require_new_password":false,
"customer_id":"x4xCwxxJxGCx123Rx5xTx",
"email_hash":"xe8x2dxffx5bx18123x69x3fxefxefxa"
}
GET /current_user

Get the logged in user

Authentication

session

Request Example
GET /current_user
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"login":"johnowner@website.com",
"name":"John Owner",
"id":"x9KzsrACXZv8tPwlEDsKb6",
"updated_at":"2012-06-21T03:22:50+00:00",
"created_at":"2012-06-20T21:52:44+00:00",
"role":"admin",
"require_new_password":false,
"customer_id":"x4xCwxxJxGCx123Rx5xTx",
"email_hash":"xe8x2dxffx5bx18123x69x3fxefxefxa"
}
GET /user/id

Get a specific user

Authentication

session

Request Example
GET /user/x9KzsrACXZv8tPwlEDsKb6
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"login":"johnowner@website.com",
"name":"John Owner",
"id":"x9KzsrACXZv8tPwlEDsKb6",
"updated_at":"2012-06-21T03:22:50+00:00",
"created_at":"2012-06-20T21:52:44+00:00",
"role":"admin",
"require_new_password":false,
"customer_id":"x4xCwxxJxGCx123Rx5xTx",
"email_hash":"xe8x2dxffx5bx18123x69x3fxefxefxa"
}
POST /user

Create a user

Authentication

session

Request Example
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"login":"johnowner@website.com",
"name":"John Owner",
"id":"x9KzsrACXZv8tPwlEDsKb6",
"updated_at":"2012-06-21T03:22:50+00:00",
"created_at":"2012-06-20T21:52:44+00:00",
"role":"admin",
"require_new_password":false,
"customer_id":"x4xCwxxJxGCx123Rx5xTx",
"email_hash":"xe8x2dxffx5bx18123x69x3fxefxefxa"
}
PUT /user/id

Update a user

Authentication

session

Request Example
PUT /user/x9KzsrACXZv8tPwlEDsKb6
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"login":"johnowner@website.com",
"name":"John Owner",
"id":"x9KzsrACXZv8tPwlEDsKb6",
"updated_at":"2012-06-21T03:22:50+00:00",
"created_at":"2012-06-20T21:52:44+00:00",
"role":"admin",
"require_new_password":false,
"customer_id":"x4xCwxxJxGCx123Rx5xTx",
"email_hash":"xe8x2dxffx5bx18123x69x3fxefxefxa"
}
DELETE /user/id

Delete a user

Authentication

session

Request Example
DELETE /user/x9KzsrACXZv8tPwlEDsKb6
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"status":"ok"
}
POST /user/login/password/request_reset

Requests a password reset for the specified user

Authentication

none

Request Example
POST /user/x9KzsrACXZv8tPwlEDsKb6/password/request_reset
Fastly-Key: d3cafb4dde4dbeef
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: application/json
{
"status":"ok"
}

VCL

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

Fields

  • name - The name of this VCL.
  • content - The VCL code to be included.
  • main - Set to true when this is the main VCL, otherwise false.

Actions

GET /service/service_id/version/version/vcl

List the uploaded VCLs for a particular service and version

Authentication

key

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

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

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

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

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

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

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/vcl
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: text/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

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

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: text/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

Request Example
PUT /service/SU1Z0isxPaozGVKXdv0eY/version/1/vcl/test-vcl
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
Response Example
HTTP/1.1 200 OK
Content-Type: text/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

  • number - The number of this version.
  • active - Whether this is the active version or not.
  • locked - Whether this version is locked or not. Objects can not be added or edited on locked versions.

Actions

GET /service/service_id/version/number

Get the version for a particular service

Authentication

key

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

Request Example
POST /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"
}
GET /service/service_id/version

List the versions for a particular service

Authentication

key

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

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

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

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

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

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

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

  • name - Name of the Wordpress object.
  • path - Requests to this path will use Wordpress configuration.

Actions

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

Get information on a specific wordpress.

Authentication

none

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

none

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

none

Request Example
POST /service/SU1Z0isxPaozGVKXdv0eY/version/1/wordpress
Fastly-Key: d3cafb4dde4dbeef
Content-Type: application/x-www-form-urlencoded
Accept: application/json
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

none

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

none

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