Skip to content
Start here

Patch Hyperdrive

PATCH/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}

Patches and returns the specified Hyperdrive configuration. Custom caching settings are not kept if caching is disabled.

Security
API Token

The preferred authorization scheme for interacting with the Cloudflare API. Create a token.

Example:Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY
API Email + API Key

The previous authorization scheme for interacting with the Cloudflare API, used in conjunction with a Global API key.

Example:X-Auth-Email: user@example.com

The previous authorization scheme for interacting with the Cloudflare API. When possible, use API tokens instead of Global API keys.

Example:X-Auth-Key: 144c9defac04969c7bfad8efaa8ea194
Accepted Permissions (at least one required)
Hyperdrive Write
Path ParametersExpand Collapse
account_id: string

Define configurations using a unique string identifier.

maxLength32
hyperdrive_id: string

Define configurations using a unique string identifier.

maxLength32
Body ParametersJSONExpand Collapse
caching: optional object { disabled } or object { disabled, max_age, stale_while_revalidate }
One of the following:
HyperdriveHyperdriveCachingCommon = object { disabled }
disabled: optional boolean

Set to true to disable caching of SQL responses. Default is false.

HyperdriveHyperdriveCachingEnabled = object { disabled, max_age, stale_while_revalidate }
disabled: optional boolean

Set to true to disable caching of SQL responses. Default is false.

max_age: optional number

Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified.

stale_while_revalidate: optional number

Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified.

mtls: optional object { ca_certificate_id, mtls_certificate_id, sslmode }
ca_certificate_id: optional string

Define CA certificate ID obtained after uploading CA cert.

mtls_certificate_id: optional string

Define mTLS certificate ID obtained after uploading client cert.

sslmode: optional string

Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA.

name: optional string

The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.

origin: optional object { database, password, scheme, user } or object { host, port } or object { access_client_id, access_client_secret, host }
One of the following:
HyperdriveHyperdriveDatabase = object { database, password, scheme, user }
database: optional string

Set the name of your origin database.

password: optional string

Set the password needed to access your origin database. The API never returns this write-only value.

scheme: optional "postgres" or "postgresql" or "mysql"

Specifies the URL scheme used to connect to your origin database.

One of the following:
"postgres"
"postgresql"
"mysql"
user: optional string

Set the user of your origin database.

HyperdriveInternetOrigin = object { host, port }
host: string

Defines the host (hostname or IP) of your origin database.

port: number

Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified.

HyperdriveOverAccessOrigin = object { access_client_id, access_client_secret, host }
access_client_id: string

Defines the Client ID of the Access token to use when connecting to the origin database.

access_client_secret: string

Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value.

host: string

Defines the host (hostname or IP) of your origin database.

origin_connection_limit: optional number

The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database.

Maximum allowed: 20 for free tier accounts, 100 for paid tier accounts. If not specified, defaults to 20 for free tier and 60 for paid tier. Contact Cloudflare if you need a higher limit.

maximum100
minimum5
ReturnsExpand Collapse
errors: array of ResponseInfo { code, message, documentation_url, source }
code: number
minimum1000
message: string
documentation_url: optional string
source: optional object { pointer }
pointer: optional string
messages: array of ResponseInfo { code, message, documentation_url, source }
code: number
minimum1000
message: string
documentation_url: optional string
source: optional object { pointer }
pointer: optional string
result: Hyperdrive { id, name, origin, 5 more }
id: string

Define configurations using a unique string identifier.

maxLength32
name: string

The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.

origin: object { database, host, password, 3 more } or object { access_client_id, access_client_secret, database, 4 more }
One of the following:
PublicDatabase = object { database, host, password, 3 more }
database: string

Set the name of your origin database.

host: string

Defines the host (hostname or IP) of your origin database.

password: string

Set the password needed to access your origin database. The API never returns this write-only value.

port: number

Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified.

scheme: "postgres" or "postgresql" or "mysql"

Specifies the URL scheme used to connect to your origin database.

One of the following:
"postgres"
"postgresql"
"mysql"
user: string

Set the user of your origin database.

AccessProtectedDatabaseBehindCloudflareTunnel = object { access_client_id, access_client_secret, database, 4 more }
access_client_id: string

Defines the Client ID of the Access token to use when connecting to the origin database.

access_client_secret: string

Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value.

database: string

Set the name of your origin database.

host: string

Defines the host (hostname or IP) of your origin database.

password: string

Set the password needed to access your origin database. The API never returns this write-only value.

scheme: "postgres" or "postgresql" or "mysql"

Specifies the URL scheme used to connect to your origin database.

One of the following:
"postgres"
"postgresql"
"mysql"
user: string

Set the user of your origin database.

caching: optional object { disabled } or object { disabled, max_age, stale_while_revalidate }
One of the following:
HyperdriveHyperdriveCachingCommon = object { disabled }
disabled: optional boolean

Set to true to disable caching of SQL responses. Default is false.

HyperdriveHyperdriveCachingEnabled = object { disabled, max_age, stale_while_revalidate }
disabled: optional boolean

Set to true to disable caching of SQL responses. Default is false.

max_age: optional number

Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified.

stale_while_revalidate: optional number

Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified.

created_on: optional string

Defines the creation time of the Hyperdrive configuration.

formatdate-time
modified_on: optional string

Defines the last modified time of the Hyperdrive configuration.

formatdate-time
mtls: optional object { ca_certificate_id, mtls_certificate_id, sslmode }
ca_certificate_id: optional string

Define CA certificate ID obtained after uploading CA cert.

mtls_certificate_id: optional string

Define mTLS certificate ID obtained after uploading client cert.

sslmode: optional string

Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA.

origin_connection_limit: optional number

The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database.

Maximum allowed: 20 for free tier accounts, 100 for paid tier accounts. If not specified, defaults to 20 for free tier and 60 for paid tier. Contact Cloudflare if you need a higher limit.

maximum100
minimum5
success: true

Return the status of the API call success.

Patch Hyperdrive

curl https://api.cloudflare.com/client/v4/accounts/$ACCOUNT_ID/hyperdrive/configs/$HYPERDRIVE_ID \
    -X PATCH \
    -H 'Content-Type: application/json' \
    -H "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
    -d '{
          "name": "example-hyperdrive",
          "origin_connection_limit": 60
        }'
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "id": "023e105f4ecef8ad9ca31a8372d0c353",
    "name": "example-hyperdrive",
    "origin": {
      "database": "postgres",
      "host": "database.example.com",
      "port": 5432,
      "scheme": "postgres",
      "user": "postgres"
    },
    "caching": {
      "disabled": true
    },
    "created_on": "2017-01-01T00:00:00Z",
    "modified_on": "2017-01-01T00:00:00Z",
    "mtls": {
      "ca_certificate_id": "00000000-0000-0000-0000-0000000000",
      "mtls_certificate_id": "00000000-0000-0000-0000-0000000000",
      "sslmode": "verify-full"
    },
    "origin_connection_limit": 60
  },
  "success": true
}
Returns Examples
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "result": {
    "id": "023e105f4ecef8ad9ca31a8372d0c353",
    "name": "example-hyperdrive",
    "origin": {
      "database": "postgres",
      "host": "database.example.com",
      "port": 5432,
      "scheme": "postgres",
      "user": "postgres"
    },
    "caching": {
      "disabled": true
    },
    "created_on": "2017-01-01T00:00:00Z",
    "modified_on": "2017-01-01T00:00:00Z",
    "mtls": {
      "ca_certificate_id": "00000000-0000-0000-0000-0000000000",
      "mtls_certificate_id": "00000000-0000-0000-0000-0000000000",
      "sslmode": "verify-full"
    },
    "origin_connection_limit": 60
  },
  "success": true
}