# Configs ## List Hyperdrives `client.hyperdrive.configs.list(ConfigListParamsparams, RequestOptionsoptions?): V4PagePaginationArray` **get** `/accounts/{account_id}/hyperdrive/configs` Returns a list of Hyperdrives. ### Parameters - `params: ConfigListParams` - `account_id: string` Path param: Define configurations using a unique string identifier. - `page?: number` Query param: Page number of paginated results. - `per_page?: number` Query param: Maximum number of results per page. ### Returns - `Hyperdrive` - `id: string` Define configurations using a unique string identifier. - `name: string` The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. - `origin: PublicDatabase | AccessProtectedDatabaseBehindCloudflareTunnel | DatabaseReachableThroughAWorkersVPC` - `PublicDatabase` - `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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `user: string` Set the user of your origin database. - `AccessProtectedDatabaseBehindCloudflareTunnel` - `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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `user: string` Set the user of your origin database. - `DatabaseReachableThroughAWorkersVPC` - `database: string` Set the name 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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `service_id: string` The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database. - `user: string` Set the user of your origin database. - `caching?: HyperdriveHyperdriveCachingCommon | HyperdriveHyperdriveCachingEnabled` - `HyperdriveHyperdriveCachingCommon` - `disabled?: boolean` Set to true to disable caching of SQL responses. Default is false. - `HyperdriveHyperdriveCachingEnabled` - `disabled?: boolean` Set to true to disable caching of SQL responses. Default is false. - `max_age?: number` Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified. - `stale_while_revalidate?: number` Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified. - `created_on?: string` Defines the creation time of the Hyperdrive configuration. - `modified_on?: string` Defines the last modified time of the Hyperdrive configuration. - `mtls?: MTLS` mTLS configuration for the origin connection. Cannot be used with VPC Service origins; TLS must be managed on the VPC Service. - `ca_certificate_id?: string` Define CA certificate ID obtained after uploading CA cert. - `mtls_certificate_id?: string` Define mTLS certificate ID obtained after uploading client cert. - `sslmode?: string` Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA. - `origin_connection_limit?: 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. Certain Cloudflare-managed origins may be permitted a higher limit. Contact Cloudflare if you need a higher limit. - `restarted_on?: string | null` Defines the last time the Hyperdrive connection pool was explicitly restarted via the restart endpoint. Omitted if the pool has never been explicitly restarted. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); // Automatically fetches more pages as needed. for await (const hyperdrive of client.hyperdrive.configs.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(hyperdrive.id); } ``` #### Response ```json { "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, "restarted_on": "2017-01-01T00:00:00Z" } ], "success": true, "result_info": { "count": 1, "page": 1, "per_page": 20, "total_count": 2000 } } ``` ## Get Hyperdrive `client.hyperdrive.configs.get(stringhyperdriveID, ConfigGetParamsparams, RequestOptionsoptions?): Hyperdrive` **get** `/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}` Returns the specified Hyperdrive configuration. ### Parameters - `hyperdriveID: string` Define configurations using a unique string identifier. - `params: ConfigGetParams` - `account_id: string` Define configurations using a unique string identifier. ### Returns - `Hyperdrive` - `id: string` Define configurations using a unique string identifier. - `name: string` The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. - `origin: PublicDatabase | AccessProtectedDatabaseBehindCloudflareTunnel | DatabaseReachableThroughAWorkersVPC` - `PublicDatabase` - `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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `user: string` Set the user of your origin database. - `AccessProtectedDatabaseBehindCloudflareTunnel` - `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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `user: string` Set the user of your origin database. - `DatabaseReachableThroughAWorkersVPC` - `database: string` Set the name 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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `service_id: string` The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database. - `user: string` Set the user of your origin database. - `caching?: HyperdriveHyperdriveCachingCommon | HyperdriveHyperdriveCachingEnabled` - `HyperdriveHyperdriveCachingCommon` - `disabled?: boolean` Set to true to disable caching of SQL responses. Default is false. - `HyperdriveHyperdriveCachingEnabled` - `disabled?: boolean` Set to true to disable caching of SQL responses. Default is false. - `max_age?: number` Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified. - `stale_while_revalidate?: number` Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified. - `created_on?: string` Defines the creation time of the Hyperdrive configuration. - `modified_on?: string` Defines the last modified time of the Hyperdrive configuration. - `mtls?: MTLS` mTLS configuration for the origin connection. Cannot be used with VPC Service origins; TLS must be managed on the VPC Service. - `ca_certificate_id?: string` Define CA certificate ID obtained after uploading CA cert. - `mtls_certificate_id?: string` Define mTLS certificate ID obtained after uploading client cert. - `sslmode?: string` Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA. - `origin_connection_limit?: 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. Certain Cloudflare-managed origins may be permitted a higher limit. Contact Cloudflare if you need a higher limit. - `restarted_on?: string | null` Defines the last time the Hyperdrive connection pool was explicitly restarted via the restart endpoint. Omitted if the pool has never been explicitly restarted. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const hyperdrive = await client.hyperdrive.configs.get('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(hyperdrive.id); ``` #### Response ```json { "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, "restarted_on": "2017-01-01T00:00:00Z" }, "success": true } ``` ## Create Hyperdrive `client.hyperdrive.configs.create(ConfigCreateParamsparams, RequestOptionsoptions?): Hyperdrive` **post** `/accounts/{account_id}/hyperdrive/configs` Creates and returns a new Hyperdrive configuration. ### Parameters - `params: ConfigCreateParams` - `account_id: string` Path param: Define configurations using a unique string identifier. - `name: string` Body param: The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. - `origin: PublicDatabase | AccessProtectedDatabaseBehindCloudflareTunnel | DatabaseReachableThroughAWorkersVPC` Body param - `PublicDatabase` - `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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `user: string` Set the user of your origin database. - `AccessProtectedDatabaseBehindCloudflareTunnel` - `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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `user: string` Set the user of your origin database. - `DatabaseReachableThroughAWorkersVPC` - `database: string` Set the name 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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `service_id: string` The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database. - `user: string` Set the user of your origin database. - `caching?: HyperdriveHyperdriveCachingCommon | HyperdriveHyperdriveCachingEnabled` Body param - `HyperdriveHyperdriveCachingCommon` - `disabled?: boolean` Set to true to disable caching of SQL responses. Default is false. - `HyperdriveHyperdriveCachingEnabled` - `disabled?: boolean` Set to true to disable caching of SQL responses. Default is false. - `max_age?: number` Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified. - `stale_while_revalidate?: number` Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified. - `mtls?: MTLS` Body param: mTLS configuration for the origin connection. Cannot be used with VPC Service origins; TLS must be managed on the VPC Service. - `ca_certificate_id?: string` Define CA certificate ID obtained after uploading CA cert. - `mtls_certificate_id?: string` Define mTLS certificate ID obtained after uploading client cert. - `sslmode?: string` Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA. - `origin_connection_limit?: number` Body param: 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. Certain Cloudflare-managed origins may be permitted a higher limit. Contact Cloudflare if you need a higher limit. ### Returns - `Hyperdrive` - `id: string` Define configurations using a unique string identifier. - `name: string` The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. - `origin: PublicDatabase | AccessProtectedDatabaseBehindCloudflareTunnel | DatabaseReachableThroughAWorkersVPC` - `PublicDatabase` - `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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `user: string` Set the user of your origin database. - `AccessProtectedDatabaseBehindCloudflareTunnel` - `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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `user: string` Set the user of your origin database. - `DatabaseReachableThroughAWorkersVPC` - `database: string` Set the name 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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `service_id: string` The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database. - `user: string` Set the user of your origin database. - `caching?: HyperdriveHyperdriveCachingCommon | HyperdriveHyperdriveCachingEnabled` - `HyperdriveHyperdriveCachingCommon` - `disabled?: boolean` Set to true to disable caching of SQL responses. Default is false. - `HyperdriveHyperdriveCachingEnabled` - `disabled?: boolean` Set to true to disable caching of SQL responses. Default is false. - `max_age?: number` Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified. - `stale_while_revalidate?: number` Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified. - `created_on?: string` Defines the creation time of the Hyperdrive configuration. - `modified_on?: string` Defines the last modified time of the Hyperdrive configuration. - `mtls?: MTLS` mTLS configuration for the origin connection. Cannot be used with VPC Service origins; TLS must be managed on the VPC Service. - `ca_certificate_id?: string` Define CA certificate ID obtained after uploading CA cert. - `mtls_certificate_id?: string` Define mTLS certificate ID obtained after uploading client cert. - `sslmode?: string` Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA. - `origin_connection_limit?: 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. Certain Cloudflare-managed origins may be permitted a higher limit. Contact Cloudflare if you need a higher limit. - `restarted_on?: string | null` Defines the last time the Hyperdrive connection pool was explicitly restarted via the restart endpoint. Omitted if the pool has never been explicitly restarted. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const hyperdrive = await client.hyperdrive.configs.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', name: 'example-hyperdrive', origin: { database: 'postgres', host: 'database.example.com', password: 'password', port: 5432, scheme: 'postgres', user: 'postgres', }, }); console.log(hyperdrive.id); ``` #### Response ```json { "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, "restarted_on": "2017-01-01T00:00:00Z" }, "success": true } ``` ## Replace Hyperdrive `client.hyperdrive.configs.update(stringhyperdriveID, ConfigUpdateParamsparams, RequestOptionsoptions?): Hyperdrive` **put** `/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}` Replaces and returns the specified Hyperdrive configuration. The request must include the name and complete origin connection details. Omitted caching settings are reset to their defaults, while omitted mTLS settings and origin connection limits are preserved. Use the update operation to modify only selected fields. ### Parameters - `hyperdriveID: string` Define configurations using a unique string identifier. - `params: ConfigUpdateParams` - `account_id: string` Path param: Define configurations using a unique string identifier. - `name: string` Body param: The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. - `origin: PublicDatabase | AccessProtectedDatabaseBehindCloudflareTunnel | DatabaseReachableThroughAWorkersVPC` Body param - `PublicDatabase` - `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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `user: string` Set the user of your origin database. - `AccessProtectedDatabaseBehindCloudflareTunnel` - `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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `user: string` Set the user of your origin database. - `DatabaseReachableThroughAWorkersVPC` - `database: string` Set the name 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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `service_id: string` The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database. - `user: string` Set the user of your origin database. - `caching?: HyperdriveHyperdriveCachingCommon | HyperdriveHyperdriveCachingEnabled` Body param - `HyperdriveHyperdriveCachingCommon` - `disabled?: boolean` Set to true to disable caching of SQL responses. Default is false. - `HyperdriveHyperdriveCachingEnabled` - `disabled?: boolean` Set to true to disable caching of SQL responses. Default is false. - `max_age?: number` Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified. - `stale_while_revalidate?: number` Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified. - `mtls?: MTLS` Body param: mTLS configuration for the origin connection. Cannot be used with VPC Service origins; TLS must be managed on the VPC Service. - `ca_certificate_id?: string` Define CA certificate ID obtained after uploading CA cert. - `mtls_certificate_id?: string` Define mTLS certificate ID obtained after uploading client cert. - `sslmode?: string` Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA. - `origin_connection_limit?: number` Body param: 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. Certain Cloudflare-managed origins may be permitted a higher limit. Contact Cloudflare if you need a higher limit. ### Returns - `Hyperdrive` - `id: string` Define configurations using a unique string identifier. - `name: string` The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. - `origin: PublicDatabase | AccessProtectedDatabaseBehindCloudflareTunnel | DatabaseReachableThroughAWorkersVPC` - `PublicDatabase` - `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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `user: string` Set the user of your origin database. - `AccessProtectedDatabaseBehindCloudflareTunnel` - `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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `user: string` Set the user of your origin database. - `DatabaseReachableThroughAWorkersVPC` - `database: string` Set the name 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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `service_id: string` The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database. - `user: string` Set the user of your origin database. - `caching?: HyperdriveHyperdriveCachingCommon | HyperdriveHyperdriveCachingEnabled` - `HyperdriveHyperdriveCachingCommon` - `disabled?: boolean` Set to true to disable caching of SQL responses. Default is false. - `HyperdriveHyperdriveCachingEnabled` - `disabled?: boolean` Set to true to disable caching of SQL responses. Default is false. - `max_age?: number` Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified. - `stale_while_revalidate?: number` Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified. - `created_on?: string` Defines the creation time of the Hyperdrive configuration. - `modified_on?: string` Defines the last modified time of the Hyperdrive configuration. - `mtls?: MTLS` mTLS configuration for the origin connection. Cannot be used with VPC Service origins; TLS must be managed on the VPC Service. - `ca_certificate_id?: string` Define CA certificate ID obtained after uploading CA cert. - `mtls_certificate_id?: string` Define mTLS certificate ID obtained after uploading client cert. - `sslmode?: string` Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA. - `origin_connection_limit?: 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. Certain Cloudflare-managed origins may be permitted a higher limit. Contact Cloudflare if you need a higher limit. - `restarted_on?: string | null` Defines the last time the Hyperdrive connection pool was explicitly restarted via the restart endpoint. Omitted if the pool has never been explicitly restarted. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const hyperdrive = await client.hyperdrive.configs.update('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', name: 'example-hyperdrive', origin: { database: 'postgres', host: 'database.example.com', password: 'password', port: 5432, scheme: 'postgres', user: 'postgres', }, }); console.log(hyperdrive.id); ``` #### Response ```json { "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, "restarted_on": "2017-01-01T00:00:00Z" }, "success": true } ``` ## Update Hyperdrive `client.hyperdrive.configs.edit(stringhyperdriveID, ConfigEditParamsparams, RequestOptionsoptions?): Hyperdrive` **patch** `/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}` Updates and returns the specified fields of the Hyperdrive configuration. Custom caching settings are not kept if caching is disabled. ### Parameters - `hyperdriveID: string` Define configurations using a unique string identifier. - `params: ConfigEditParams` - `account_id: string` Path param: Define configurations using a unique string identifier. - `caching?: HyperdriveHyperdriveCachingCommon | HyperdriveHyperdriveCachingEnabled` Body param - `HyperdriveHyperdriveCachingCommon` - `disabled?: boolean` Set to true to disable caching of SQL responses. Default is false. - `HyperdriveHyperdriveCachingEnabled` - `disabled?: boolean` Set to true to disable caching of SQL responses. Default is false. - `max_age?: number` Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified. - `stale_while_revalidate?: number` Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified. - `mtls?: MTLS` Body param: mTLS configuration for the origin connection. Cannot be used with VPC Service origins; TLS must be managed on the VPC Service. - `ca_certificate_id?: string` Define CA certificate ID obtained after uploading CA cert. - `mtls_certificate_id?: string` Define mTLS certificate ID obtained after uploading client cert. - `sslmode?: string` Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA. - `name?: string` Body param: The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. - `origin?: HyperdriveHyperdriveDatabase | HyperdriveInternetOrigin | HyperdriveOverAccessOrigin | HyperdriveVPCServiceOrigin` Body param: Connect to a database through a Workers VPC Service. TLS settings (mTLS, sslmode) cannot be configured on the Hyperdrive when using a VPC Service origin; TLS must be managed on the VPC Service itself. - `HyperdriveHyperdriveDatabase` - `database?: string` Set the name 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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `user?: string` Set the user of your origin database. - `HyperdriveInternetOrigin` - `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` - `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. - `HyperdriveVPCServiceOrigin` Connect to a database through a Workers VPC Service. TLS settings (mTLS, sslmode) cannot be configured on the Hyperdrive when using a VPC Service origin; TLS must be managed on the VPC Service itself. - `service_id: string` The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database. - `origin_connection_limit?: number` Body param: 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. Certain Cloudflare-managed origins may be permitted a higher limit. Contact Cloudflare if you need a higher limit. ### Returns - `Hyperdrive` - `id: string` Define configurations using a unique string identifier. - `name: string` The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API. - `origin: PublicDatabase | AccessProtectedDatabaseBehindCloudflareTunnel | DatabaseReachableThroughAWorkersVPC` - `PublicDatabase` - `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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `user: string` Set the user of your origin database. - `AccessProtectedDatabaseBehindCloudflareTunnel` - `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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `user: string` Set the user of your origin database. - `DatabaseReachableThroughAWorkersVPC` - `database: string` Set the name 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" | "postgresql" | "mysql"` Specifies the URL scheme used to connect to your origin database. - `"postgres"` - `"postgresql"` - `"mysql"` - `service_id: string` The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database. - `user: string` Set the user of your origin database. - `caching?: HyperdriveHyperdriveCachingCommon | HyperdriveHyperdriveCachingEnabled` - `HyperdriveHyperdriveCachingCommon` - `disabled?: boolean` Set to true to disable caching of SQL responses. Default is false. - `HyperdriveHyperdriveCachingEnabled` - `disabled?: boolean` Set to true to disable caching of SQL responses. Default is false. - `max_age?: number` Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified. - `stale_while_revalidate?: number` Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified. - `created_on?: string` Defines the creation time of the Hyperdrive configuration. - `modified_on?: string` Defines the last modified time of the Hyperdrive configuration. - `mtls?: MTLS` mTLS configuration for the origin connection. Cannot be used with VPC Service origins; TLS must be managed on the VPC Service. - `ca_certificate_id?: string` Define CA certificate ID obtained after uploading CA cert. - `mtls_certificate_id?: string` Define mTLS certificate ID obtained after uploading client cert. - `sslmode?: string` Set SSL mode to 'require', 'verify-ca', or 'verify-full' to verify the CA. - `origin_connection_limit?: 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. Certain Cloudflare-managed origins may be permitted a higher limit. Contact Cloudflare if you need a higher limit. - `restarted_on?: string | null` Defines the last time the Hyperdrive connection pool was explicitly restarted via the restart endpoint. Omitted if the pool has never been explicitly restarted. ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const hyperdrive = await client.hyperdrive.configs.edit('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(hyperdrive.id); ``` #### Response ```json { "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, "restarted_on": "2017-01-01T00:00:00Z" }, "success": true } ``` ## Delete Hyperdrive `client.hyperdrive.configs.delete(stringhyperdriveID, ConfigDeleteParamsparams, RequestOptionsoptions?): ConfigDeleteResponse | null` **delete** `/accounts/{account_id}/hyperdrive/configs/{hyperdrive_id}` Deletes the specified Hyperdrive. ### Parameters - `hyperdriveID: string` Define configurations using a unique string identifier. - `params: ConfigDeleteParams` - `account_id: string` Define configurations using a unique string identifier. ### Returns - `ConfigDeleteResponse = unknown` ### Example ```typescript import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const config = await client.hyperdrive.configs.delete('023e105f4ecef8ad9ca31a8372d0c353', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(config); ``` #### Response ```json { "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": {}, "success": true } ``` ## Domain Types ### Config Delete Response - `ConfigDeleteResponse = unknown`