CloudFront Cache Policy API

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

Business capability
IT Infrastructure Management BC-600.50

Operations 6

POST /2020-05-31/cache-policy Create Cache Policy #
GET /2020-05-31/cache-policy List Cache Policies #
DELETE /2020-05-31/cache-policy/{Id} Delete Cache Policy #
GET /2020-05-31/cache-policy/{Id} Get Cache Policy #
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"

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

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. 6 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:
    post:
      operationId: CreateCachePolicy
      summary: Create Cache Policy
      description: 'Creates a cache policy. After you create a cache policy, you can attach it to one or more cache behaviors.
        When it''s attached to a cache behavior, the cache policy determines the following: The values that CloudFront includes
        in the cache key. These values can include HTTP headers, cookies, and URL query strings. CloudFront uses the cache
        key to find an object in its cache that it can return to the viewer. The default, minimum, and maximum time to live
        (TTL) values that you want objects to stay in the CloudFront cache. 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. The headers, cookies, and query strings
        that are included in the cache key are also included in requests that CloudFront sends to the origin. CloudFront sends
        a request when it can''t find an object in its cache that matches the request''s cache key. If you want to send values
        to the origin but not include them in the cache key, use OriginRequestPolicy. For more information about cache policies,
        see Controlling the cache key in t'
      responses:
        '200':
          description: Success
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/CreateCachePolicyResult'
        '403':
          description: AccessDenied
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/AccessDenied'
        '409':
          description: CachePolicyAlreadyExists
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/CachePolicyAlreadyExists'
        '400':
          description: InconsistentQuantities; InvalidArgument; TooManyCachePolicies; TooManyCookiesInCachePolicy; TooManyHeadersInCachePolicy;
            TooManyQueryStringsInCachePolicy
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/InconsistentQuantities'
      requestBody:
        content:
          application/xml:
            schema:
              $ref: '#/components/schemas/CreateCachePolicyRequest'
      tags:
      - Cache Policy
    get:
      operationId: ListCachePolicies
      summary: List Cache Policies
      description: Gets a list of cache policies. You can optionally apply a filter to return only the managed policies created
        by Amazon Web Services, or only the custom policies created in your Amazon Web Services account. You can optionally
        specify the maximum number of items to receive in the response. If the total number of items in the list exceeds the
        maximum that you specify, or the default maximum, the response is paginated. To get the next page of items, send a
        subsequent request that specifies the NextMarker value from the current response as the Marker value in the subsequent
        request.
      responses:
        '200':
          description: Success
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/ListCachePoliciesResult'
        '403':
          description: AccessDenied
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/AccessDenied'
        '400':
          description: InvalidArgument
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/InvalidArgument'
        '404':
          description: NoSuchCachePolicy
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/NoSuchCachePolicy'
      requestBody:
        content:
          application/xml:
            schema:
              $ref: '#/components/schemas/ListCachePoliciesRequest'
      tags:
      - Cache Policy
  /2020-05-31/cache-policy/{Id}:
    delete:
      operationId: DeleteCachePolicy
      summary: Delete Cache Policy
      description: Deletes a cache policy. You cannot delete a cache policy if it's attached to a cache behavior. First update
        your distributions to remove the cache policy from all cache behaviors, then delete the cache policy. To delete a
        cache policy, you must provide the policy's identifier and version. To get these values, you can use ListCachePolicies
        or GetCachePolicy.
      responses:
        '200':
          description: Success
          content:
            text/xml:
              schema:
                type: string
        '403':
          description: AccessDenied
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/AccessDenied'
        '409':
          description: CachePolicyInUse
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/CachePolicyInUse'
        '400':
          description: IllegalDelete; InvalidIfMatchVersion
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/IllegalDelete'
        '404':
          description: NoSuchCachePolicy
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/NoSuchCachePolicy'
        '412':
          description: PreconditionFailed
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/PreconditionFailed'
      requestBody:
        content:
          application/xml:
            schema:
              $ref: '#/components/schemas/DeleteCachePolicyRequest'
      tags:
      - Cache Policy
    get:
      operationId: GetCachePolicy
      summary: Get Cache Policy
      description: 'Gets a cache policy, including the following metadata: The policy''s identifier. The date and time when
        the policy was last modified. To get a cache policy, 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/GetCachePolicyResult'
        '403':
          description: AccessDenied
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/AccessDenied'
        '404':
          description: NoSuchCachePolicy
          content:
            text/xml:
              schema:
                $ref: '#/components/schemas/NoSuchCachePolicy'
      requestBody:
        content:
          application/xml:
            schema:
              $ref: '#/components/schemas/GetCachePolicyRequest'
      tags:
      - Cache Policy
    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'
      requestBody:
        content:
          application/xml:
            schema:
              $ref: '#/components/schemas/UpdateCachePolicyRequest'
      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'
      requestBody:
        content:
          application/xml:
            schema:
              $ref: '#/components/schemas/GetCachePolicyConfigRequest'
      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
    CachePolicyInUse:
      type: object
      properties:
        Message:
          type: string
    CachePolicyList:
      type: object
      properties:
        NextMarker:
          type: string
          description: If there are more items in the list than are in this response, this element is present. It contains
            the value that you should use in the Marker field of a subsequent request to continue listing cache policies where
            you left off.
        MaxItems:
          type: integer
          description: The maximum number of cache policies requested.
        Quantity:
          type: integer
          description: The total number of cache policies returned in the response.
        Items:
          type: array
          items:
            $ref: '#/components/schemas/CachePolicySummary'
          description: Contains the cache policies in the list.
      required:
      - MaxItems
      - Quantity
    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
    CachePolicySummary:
      type: object
      properties:
        Type:
          type: string
          enum:
          - managed
          - custom
          description: The type of cache policy, either managed (created by Amazon Web Services) or custom (created in this
            Amazon Web Services account).
        CachePolicy:
          $ref: '#/components/schemas/CachePolicy'
      required:
      - Type
      - CachePolicy
    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
    CreateCachePolicyRequest:
      type: object
      properties:
        CachePolicyConfig:
          $ref: '#/components/schemas/CachePolicyConfig'
      required:
      - CachePolicyConfig
    CreateCachePolicyResult:
      type: object
      properties:
        CachePolicy:
          $ref: '#/components/schemas/CachePolicy'
        Location:
          type: string
          description: The fully qualified URI of the cache policy just created.
        ETag:
          type: string
          description: The current version of the cache policy.
    DeleteCachePolicyRequest:
      type: object
      properties:
        Id:
          type: string
          description: The unique identifier for the cache policy that you are deleting. To get the identifier, you can use
            ListCachePolicies.
        IfMatch:
          type: string
          description: The version of the cache policy that you are deleting. The version is the cache policy's ETag value,
            which you can get using ListCachePolicies, GetCachePolicy, or GetCachePolicyConfig.
      required:
      - Id
    GetCachePolicyConfigRequest:
      type: object
      properties:
        Id:
          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.
      required:
      - Id
    GetCachePolicyConfigResult:
      type: object
      properties:
        CachePolicyConfig:
          $ref: '#/components/schemas/CachePolicyConfig'
        ETag:
          type: string
          description: The current version of the cache policy.
    GetCachePolicyRequest:
      type: object
      properties:
        Id:
          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.
      required:
      - Id
    GetCachePolicyResult:
      type: object
      properties:
        CachePolicy:
          $ref: '#/components/schemas/CachePolicy'
        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
    IllegalDelete:
      type: object
      properties:
        Message:
          type: string
    IllegalUpdate:
      type: object
      properties:
        Message:
          type: string
    InconsistentQuantities:
      type: object
      properties:
        Message:
          type: string
    InvalidArgument:
      type: object
      properties:
        Message:
          type: string
    ListCachePoliciesRequest:
      type: object
      properties:
        Type:
          type: string
          enum:
          - managed
          - custom
          description: 'A filter to return only the specified kinds of cache policies. Valid values are: managed – Returns
            only the managed policies created by Amazon Web Services. custom – Returns only the custom policies created in
            your Amazon Web Services account.'
        Marker:
          type: string
          description: Use this field when paginating results to indicate where to begin in your list of cache policies. The
            response includes cache policies in the list that occur after the marker. To get the next page of the list, set
            this field's value to the value of NextMarker from the current page's response.
        MaxItems:
          type: integer
          description: The maximum number of cache policies that you want in the response.
    ListCachePoliciesResult:
      type: object
      properties:
        CachePolicyList:
          $ref: '#/components/schemas/CachePolicyList'
    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
    UpdateCachePolicyRequest:
      type: object
      properties:
        CachePolicyConfig:
          $ref: '#/components/schemas/CachePolicyConfig'
        Id:
          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.
        IfMatch:
          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.
      required:
      - CachePolicyConfig
      - Id
    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/582e55931c45b944739742a2c1620b6026dd2d13/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)