CloudFront Cache Policy API

The Cache Policy API from CloudFront — 3 operation(s) for cache policy.

GitHub OpenAPI
Business capability
IT Infrastructure Management BC-600.50

Operations 2

PUT /2020-05-31/cache-policy/{Id} Update Cache Policy #
GET /2020-05-31/cache-policy/{Id}/config Get Cache Policy Config #

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/cloudfront:cloudfront-cache-policy-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

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. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

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

OpenAPI Specification

cloudfront-cache-policy-api-openapi.yml Raw ↑
openapi: 3.1.0
info:
  title: Amazon CloudFront Cache Policy API
  version: '2020-05-31'
  description: Generated from AWS's published Smithy model for Amazon CloudFront. 2 operation(s).
  contact:
    name: Amazon Web Services
    url: https://aws.amazon.com/contact-us/
  license:
    name: Apache 2.0
    identifier: Apache-2.0
    url: https://github.com/aws/api-models-aws/blob/main/LICENSE
servers:
- url: https://cloudfront.{region}.amazonaws.com
  variables:
    region:
      default: us-east-1
security:
- sigv4: []
paths:
  /2020-05-31/cache-policy/{Id}:
    put:
      operationId: UpdateCachePolicy
      summary: Update Cache Policy
      description: 'Updates a cache policy configuration. When you update a cache policy configuration, all the fields are
        updated with the values provided in the request. You cannot update some fields independent of others. To update a
        cache policy configuration: Use GetCachePolicyConfig to get the current configuration. Locally modify the fields in
        the cache policy configuration that you want to update. Call UpdateCachePolicy by providing the entire cache policy
        configuration, including the fields that you modified and those that you didn''t. If your minimum TTL is greater than
        0, CloudFront will cache content for at least the duration specified in the cache policy''s minimum TTL, even if the
        Cache-Control: no-cache, no-store, or private directives are present in the origin headers.'
      responses:
        '200':
          description: Success
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/UpdateCachePolicyResult'
        '403':
          description: AccessDenied
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/AccessDenied'
        '409':
          description: CachePolicyAlreadyExists
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/CachePolicyAlreadyExists'
        '400':
          description: IllegalUpdate; InconsistentQuantities; InvalidArgument; InvalidIfMatchVersion; TooManyCookiesInCachePolicy;
            TooManyHeadersInCachePolicy; TooManyQueryStringsInCachePolicy
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/IllegalUpdate'
        '404':
          description: NoSuchCachePolicy
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/NoSuchCachePolicy'
        '412':
          description: PreconditionFailed
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/PreconditionFailed'
      parameters:
      - name: Id
        in: path
        required: true
        schema:
          type: string
        description: The unique identifier for the cache policy that you are updating. The identifier is returned in a cache
          behavior's CachePolicyId field in the response to GetDistributionConfig.
      - name: If-Match
        in: header
        schema:
          type: string
        description: The version of the cache policy that you are updating. The version is returned in the cache policy's
          ETag field in the response to GetCachePolicyConfig.
      requestBody:
        content:
          application/xml:
            schema:
              $ref: '#/components/schemas/CachePolicyConfig'
      tags:
      - Cache Policy
  /2020-05-31/cache-policy/{Id}/config:
    get:
      operationId: GetCachePolicyConfig
      summary: Get Cache Policy Config
      description: Gets a cache policy configuration. To get a cache policy configuration, you must provide the policy's identifier.
        If the cache policy is attached to a distribution's cache behavior, you can get the policy's identifier using ListDistributions
        or GetDistribution. If the cache policy is not attached to a cache behavior, you can get the identifier using ListCachePolicies.
      responses:
        '200':
          description: Success
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/GetCachePolicyConfigResult'
        '403':
          description: AccessDenied
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/AccessDenied'
        '404':
          description: NoSuchCachePolicy
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/NoSuchCachePolicy'
      parameters:
      - name: Id
        in: path
        required: true
        schema:
          type: string
        description: The unique identifier for the cache policy. If the cache policy is attached to a distribution's cache
          behavior, you can get the policy's identifier using ListDistributions or GetDistribution. If the cache policy is
          not attached to a cache behavior, you can get the identifier using ListCachePolicies.
      tags:
      - Cache Policy
components:
  securitySchemes:
    sigv4:
      type: apiKey
      in: header
      name: Authorization
      description: AWS Signature Version 4. The Authorization header carries an AWS4-HMAC-SHA256 signature over the canonical
        request, with X-Amz-Date (and X-Amz-Security-Token for temporary credentials). Not a bearer token.
      x-aws-sigv4:
        signingName: cloudfront
  schemas:
    AccessDenied:
      type: object
      properties:
        Message:
          type: string
    CachePolicy:
      type: object
      properties:
        Id:
          type: string
          description: The unique identifier for the cache policy.
        LastModifiedTime:
          type: string
          format: date-time
          description: The date and time when the cache policy was last modified.
        CachePolicyConfig:
          $ref: '#/components/schemas/CachePolicyConfig'
      required:
      - Id
      - LastModifiedTime
      - CachePolicyConfig
    CachePolicyAlreadyExists:
      type: object
      properties:
        Message:
          type: string
    CachePolicyConfig:
      type: object
      properties:
        Comment:
          type: string
          description: A comment to describe the cache policy. The comment cannot be longer than 128 characters.
        Name:
          type: string
          description: A unique name to identify the cache policy.
        DefaultTTL:
          type: integer
          description: The default amount of time, in seconds, that you want objects to stay in the CloudFront cache before
            CloudFront sends another request to the origin to see if the object has been updated. CloudFront uses this value
            as the object's time to live (TTL) only when the origin does not send Cache-Control or Expires headers with the
            object. For more information, see Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon
            CloudFront Developer Guide. The default value for this field is 86400 seconds (one day). If the value of MinTTL
            is more than 86400 seconds, then the default value f
        MaxTTL:
          type: integer
          description: The maximum amount of time, in seconds, that objects stay in the CloudFront cache before CloudFront
            sends another request to the origin to see if the object has been updated. CloudFront uses this value only when
            the origin sends Cache-Control or Expires headers with the object. For more information, see Managing How Long
            Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide. The default value for this
            field is 31536000 seconds (one year). If the value of MinTTL or DefaultTTL is more than 31536000 seconds, then
            the default value for this field is the same as the v
        MinTTL:
          type: integer
          description: The minimum amount of time, in seconds, that you want objects to stay in the CloudFront cache before
            CloudFront sends another request to the origin to see if the object has been updated. For more information, see
            Managing How Long Content Stays in an Edge Cache (Expiration) in the Amazon CloudFront Developer Guide.
        ParametersInCacheKeyAndForwardedToOrigin:
          $ref: '#/components/schemas/ParametersInCacheKeyAndForwardedToOrigin'
      required:
      - Name
      - MinTTL
    CachePolicyCookiesConfig:
      type: object
      properties:
        CookieBehavior:
          type: string
          enum:
          - none
          - whitelist
          - allExcept
          - all
          description: 'Determines whether any cookies in viewer requests are included in the cache key and in requests that
            CloudFront sends to the origin. Valid values are: none – No cookies in viewer requests are included in the cache
            key or in requests that CloudFront sends to the origin. Even when this field is set to none, any cookies that
            are listed in an OriginRequestPolicy are included in origin requests. whitelist – Only the cookies in viewer requests
            that are listed in the CookieNames type are included in the cache key and in requests that CloudFront sends to
            the origin. allExcept – All cookies in viewer r'
        Cookies:
          $ref: '#/components/schemas/CookieNames'
      required:
      - CookieBehavior
    CachePolicyHeadersConfig:
      type: object
      properties:
        HeaderBehavior:
          type: string
          enum:
          - none
          - whitelist
          description: 'Determines whether any HTTP headers are included in the cache key and in requests that CloudFront
            sends to the origin. Valid values are: none – No HTTP headers are included in the cache key or in requests that
            CloudFront sends to the origin. Even when this field is set to none, any headers that are listed in an OriginRequestPolicy
            are included in origin requests. whitelist – Only the HTTP headers that are listed in the Headers type are included
            in the cache key and in requests that CloudFront sends to the origin.'
        Headers:
          $ref: '#/components/schemas/Headers'
      required:
      - HeaderBehavior
    CachePolicyQueryStringsConfig:
      type: object
      properties:
        QueryStringBehavior:
          type: string
          enum:
          - none
          - whitelist
          - allExcept
          - all
          description: 'Determines whether any URL query strings in viewer requests are included in the cache key and in requests
            that CloudFront sends to the origin. Valid values are: none – No query strings in viewer requests are included
            in the cache key or in requests that CloudFront sends to the origin. Even when this field is set to none, any
            query strings that are listed in an OriginRequestPolicy are included in origin requests. whitelist – Only the
            query strings in viewer requests that are listed in the QueryStringNames type are included in the cache key and
            in requests that CloudFront sends to the origin. al'
        QueryStrings:
          $ref: '#/components/schemas/QueryStringNames'
      required:
      - QueryStringBehavior
    CookieNames:
      type: object
      properties:
        Quantity:
          type: integer
          description: The number of cookie names in the Items list.
        Items:
          type: array
          items:
            type: string
          description: A list of cookie names.
      required:
      - Quantity
    GetCachePolicyConfigResult:
      type: object
      properties:
        CachePolicyConfig:
          $ref: '#/components/schemas/CachePolicyConfig'
        ETag:
          type: string
          description: The current version of the cache policy.
    Headers:
      type: object
      properties:
        Quantity:
          type: integer
          description: The number of header names in the Items list.
        Items:
          type: array
          items:
            type: string
          description: A list of HTTP header names.
      required:
      - Quantity
    IllegalUpdate:
      type: object
      properties:
        Message:
          type: string
    NoSuchCachePolicy:
      type: object
      properties:
        Message:
          type: string
    ParametersInCacheKeyAndForwardedToOrigin:
      type: object
      properties:
        EnableAcceptEncodingGzip:
          type: boolean
          description: 'A flag that can affect whether the Accept-Encoding HTTP header is included in the cache key and included
            in requests that CloudFront sends to the origin. This field is related to the EnableAcceptEncodingBrotli field.
            If one or both of these fields is true and the viewer request includes the Accept-Encoding header, then CloudFront
            does the following: Normalizes the value of the viewer''s Accept-Encoding header Includes the normalized header
            in the cache key Includes the normalized header in the request to the origin, if a request is necessary For more
            information, see Compression support in the '
        EnableAcceptEncodingBrotli:
          type: boolean
          description: 'A flag that can affect whether the Accept-Encoding HTTP header is included in the cache key and included
            in requests that CloudFront sends to the origin. This field is related to the EnableAcceptEncodingGzip field.
            If one or both of these fields is true and the viewer request includes the Accept-Encoding header, then CloudFront
            does the following: Normalizes the value of the viewer''s Accept-Encoding header Includes the normalized header
            in the cache key Includes the normalized header in the request to the origin, if a request is necessary For more
            information, see Compression support in the Am'
        HeadersConfig:
          $ref: '#/components/schemas/CachePolicyHeadersConfig'
        CookiesConfig:
          $ref: '#/components/schemas/CachePolicyCookiesConfig'
        QueryStringsConfig:
          $ref: '#/components/schemas/CachePolicyQueryStringsConfig'
      required:
      - EnableAcceptEncodingGzip
      - HeadersConfig
      - CookiesConfig
      - QueryStringsConfig
    PreconditionFailed:
      type: object
      properties:
        Message:
          type: string
    QueryStringNames:
      type: object
      properties:
        Quantity:
          type: integer
          description: The number of query string names in the Items list.
        Items:
          type: array
          items:
            type: string
          description: A list of query string names.
      required:
      - Quantity
    UpdateCachePolicyResult:
      type: object
      properties:
        CachePolicy:
          $ref: '#/components/schemas/CachePolicy'
        ETag:
          type: string
          description: The current version of the cache policy.
x-provenance:
  method: harvested
  publisher: Amazon Web Services
  source: https://raw.githubusercontent.com/aws/api-models-aws/3cd98287b471c106254abd89279cc87308d38bfd/models/cloudfront/service/2020-05-31/cloudfront-2020-05-31.json
  note: converted by smithy-to-openapi.py from AWS's Smithy model (roadmap#1001)