Fastly Purging API

Operations for purging cached content from Fastly's edge network, including single URL purges, surrogate key purges, bulk surrogate key purges, and purge-all operations.

Operations 4

POST /purge/{cached_url} Purge a URL #
POST /service/{service_id}/purge/{surrogate_key} Purge by surrogate key #
POST /service/{service_id}/purge Bulk purge by surrogate key #
POST /service/{service_id}/purge_all Purge all cached content #

Documentation

📖
Documentation
https://www.fastly.com/documentation/reference/api/services/
📖
Documentation
https://www.fastly.com/documentation/reference/api/purging/
📖
Documentation
https://www.fastly.com/documentation/reference/api/logging/
📖
Documentation
https://www.fastly.com/documentation/reference/api/metrics-stats/
📖
Documentation
https://www.fastly.com/documentation/reference/api/tls/
📖
Documentation
https://www.fastly.com/documentation/reference/api/vcl-services/
📖
Documentation
https://www.fastly.com/documentation/reference/api/account/
📖
Documentation
https://www.fastly.com/documentation/reference/api/auth-tokens/
📖
Documentation
https://www.fastly.com/documentation/reference/api/acls/
📖
Documentation
https://www.fastly.com/documentation/reference/api/dictionaries/
📖
Documentation
https://www.fastly.com/documentation/guides/compute/
📖
Documentation
https://www.fastly.com/documentation/reference/api/ngwaf/
📖
Documentation
https://www.fastly.com/documentation/reference/api/domain-management/
📖
Documentation
https://www.fastly.com/documentation/reference/api/products/
📖
Documentation
https://www.fastly.com/documentation/reference/api/observability/
📖
Documentation
https://www.fastly.com/documentation/reference/api/api-security/
📖
Documentation
https://www.fastly.com/documentation/reference/api/ddos-protection/
📖
Documentation
https://www.fastly.com/documentation/reference/api/client-side-protection/
📖
Documentation
https://www.fastly.com/documentation/reference/api/publishing/
📖
Documentation
https://www.fastly.com/documentation/reference/api/load-balancing/
📖
Documentation
https://www.fastly.com/documentation/reference/api/utils/
📖
Documentation
https://www.fastly.com/products/ai
📖
Documentation
https://www.fastly.com/products/object-storage

Specifications

Other Resources

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/fastly-purging-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

fastly-purging-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Fastly Purging API
  description: The Fastly Purging API enables developers to instantly remove cached content from Fastly's edge network so it can be refreshed from origin servers. It supports single URL purges, surrogate key purges for invalidating groups of related objects, and purge-all operations to clear an entire service cache. Surrogate key and URL purges are separately limited to an average of 100,000 purges per hour per customer and are not counted against the general API rate limit.
  version: '1.0'
  contact:
    name: Fastly Support
    url: https://support.fastly.com
  termsOfService: https://www.fastly.com/terms
servers:
- url: https://api.fastly.com
  description: Fastly API Production Server
security:
- apiKeyAuth: []
tags:
- name: Purging
  description: Operations for purging cached content from Fastly's edge network, including single URL purges, surrogate key purges, bulk surrogate key purges, and purge-all operations.
paths:
  /purge/{cached_url}:
    post:
      operationId: purgeSingleUrl
      summary: Purge a URL
      description: Instantly purges a single URL from Fastly's edge cache. The cached URL should be the full URL of the object to purge. Supports soft purge via the Fastly-Soft-Purge header, which marks the object as stale rather than removing it immediately.
      tags:
      - Purging
      parameters:
      - name: cached_url
        in: path
        required: true
        description: The full URL of the cached object to purge.
        schema:
          type: string
          format: uri
      - $ref: '#/components/parameters/softPurge'
      responses:
        '200':
          description: Successfully purged the URL.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PurgeResponse'
        '401':
          description: Unauthorized. The API token is missing or invalid.
        '404':
          description: The cached URL was not found.
  /service/{service_id}/purge/{surrogate_key}:
    post:
      operationId: purgeBySurrogateKey
      summary: Purge by surrogate key
      description: Instantly purges all objects from Fastly's edge cache that match the specified surrogate key tag for the given service. Supports soft purge via the Fastly-Soft-Purge header.
      tags:
      - Purging
      parameters:
      - $ref: '#/components/parameters/serviceId'
      - name: surrogate_key
        in: path
        required: true
        description: The surrogate key tag to purge.
        schema:
          type: string
      - $ref: '#/components/parameters/softPurge'
      responses:
        '200':
          description: Successfully purged objects by surrogate key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PurgeResponse'
        '401':
          description: Unauthorized. The API token is missing or invalid.
        '404':
          description: Service not found.
  /service/{service_id}/purge:
    post:
      operationId: bulkPurgeBySurrogateKey
      summary: Bulk purge by surrogate key
      description: Purges multiple surrogate key tags from Fastly's edge cache in a single request. Up to 256 surrogate keys can be purged in one batch request. Keys can be sent in a JSON object in the request body or as a Surrogate-Key request header. Supports soft purge via the Fastly-Soft-Purge header.
      tags:
      - Purging
      parameters:
      - $ref: '#/components/parameters/serviceId'
      - $ref: '#/components/parameters/softPurge'
      - name: Surrogate-Key
        in: header
        description: Space-separated list of surrogate keys to purge. Alternative to sending keys in the request body.
        schema:
          type: string
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                surrogate_keys:
                  type: array
                  description: A list of surrogate key tags to purge. Maximum of 256 keys.
                  items:
                    type: string
                  maxItems: 256
      responses:
        '200':
          description: Successfully purged objects by surrogate keys.
          content:
            application/json:
              schema:
                type: object
                properties:
                  purge_statuses:
                    type: object
                    description: A map of surrogate keys to their purge status identifiers.
                    additionalProperties:
                      type: string
        '401':
          description: Unauthorized. The API token is missing or invalid.
        '404':
          description: Service not found.
  /service/{service_id}/purge_all:
    post:
      operationId: purgeAll
      summary: Purge all cached content
      description: Instantly purges all cached content from Fastly's edge network for the specified service. This operation cannot be performed as a soft purge and will always immediately invalidate all cached content associated with the service.
      tags:
      - Purging
      parameters:
      - $ref: '#/components/parameters/serviceId'
      responses:
        '200':
          description: Successfully purged all cached content for the service.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PurgeResponse'
        '401':
          description: Unauthorized. The API token is missing or invalid.
        '404':
          description: Service not found.
components:
  parameters:
    serviceId:
      name: service_id
      in: path
      required: true
      description: The alphanumeric string identifying the Fastly service.
      schema:
        type: string
    softPurge:
      name: Fastly-Soft-Purge
      in: header
      description: Set to 1 to perform a soft purge, which marks the cached object as stale rather than immediately removing it. Stale objects can still be served while a fresh copy is fetched from origin.
      schema:
        type: integer
        enum:
        - 1
  schemas:
    PurgeResponse:
      type: object
      description: The response from a purge operation confirming the purge was accepted.
      properties:
        status:
          type: string
          description: The status of the purge operation.
          enum:
          - ok
        id:
          type: string
          description: A unique identifier for the purge operation.
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: Fastly-Key
      description: API token used to authenticate requests to the Fastly API.
externalDocs:
  description: Fastly Purging API Documentation
  url: https://www.fastly.com/documentation/reference/api/purging/