{"command":{"effect":"write","timeoutSeconds":30,"inputSchema":{"type":"object","description":"Creates and returns a new Hyperdrive configuration. For a PlanetScale integration, the Cloudflare account must already be linked to PlanetScale in the Hyperdrive dashboard.","properties":{"path":{"type":"object","properties":{"account_id":{"$ref":"#/definitions/hyperdrive_identifier","description":"The Cloudflare account ID."}},"required":["account_id"],"additionalProperties":false},"body":{"$ref":"#/definitions/hyperdrive_hyperdrive-config-create"}},"required":["path","body"],"additionalProperties":false,"definitions":{"hyperdrive_identifier":{"description":"Define configurations using a unique string identifier.","type":"string","maxLength":32,"examples":["023e105f4ecef8ad9ca31a8372d0c353"]},"hyperdrive_hyperdrive-config-create":{"description":"A request to create a Hyperdrive configuration using exactly one of caller-supplied origin credentials or a managed integration.","oneOf":[{"$ref":"#/definitions/hyperdrive_hyperdrive-config-create-with-origin"},{"$ref":"#/definitions/hyperdrive_hyperdrive-config-create-with-integration"}]},"hyperdrive_hyperdrive-config-create-with-origin":{"allOf":[{"$ref":"#/definitions/hyperdrive_hyperdrive-config-create-common"},{"not":{"properties":{"integration":{"type":"object"}},"required":["integration"],"type":"object"},"properties":{"integration":{"type":["object","null"]},"origin":{"$ref":"#/definitions/hyperdrive_hyperdrive-origin-full"}},"required":["origin"],"type":"object"}],"title":"Connect using origin credentials"},"hyperdrive_hyperdrive-config-create-with-integration":{"allOf":[{"$ref":"#/definitions/hyperdrive_hyperdrive-config-create-common"},{"not":{"properties":{"origin":{"type":"object","minProperties":1}},"required":["origin"],"type":"object"},"properties":{"integration":{"$ref":"#/definitions/hyperdrive_hyperdrive-planet-scale-integration"},"origin":{"type":["object","null"]}},"required":["integration"],"type":"object"}],"title":"Connect using a PlanetScale integration"},"hyperdrive_hyperdrive-config-create-common":{"type":"object","properties":{"caching":{"$ref":"#/definitions/hyperdrive_hyperdrive-caching-create"},"mtls":{"$ref":"#/definitions/hyperdrive_hyperdrive-mtls"},"name":{"$ref":"#/definitions/hyperdrive_hyperdrive-name"},"origin_connection_limit":{"$ref":"#/definitions/hyperdrive_hyperdrive-origin-connection-limit"}},"required":["name"]},"hyperdrive_hyperdrive-origin-full":{"description":"Combines database connection fields with exactly one supported network location.","type":"object","oneOf":[{"allOf":[{"$ref":"#/definitions/hyperdrive_hyperdrive-database-full"},{"$ref":"#/definitions/hyperdrive_internet-origin"}],"title":"Public Database"},{"allOf":[{"$ref":"#/definitions/hyperdrive_hyperdrive-database-full"},{"$ref":"#/definitions/hyperdrive_over-access-origin"}],"title":"Access-protected Database behind Cloudflare Tunnel"},{"allOf":[{"$ref":"#/definitions/hyperdrive_hyperdrive-database-full"},{"$ref":"#/definitions/hyperdrive_vpc-service-origin"}],"title":"Database reachable through a Workers VPC"}]},"hyperdrive_hyperdrive-planet-scale-integration":{"description":"Selects a PlanetScale database and provisions credentials managed by Cloudflare when creating a Hyperdrive configuration. The Cloudflare account must already be linked to PlanetScale in the Hyperdrive dashboard. The selection is returned as read-only metadata and cannot be changed with replace or update operations.","type":"object","properties":{"custom_database_name":{"description":"The database name to use when connecting. Defaults to `postgres` for PostgreSQL and `mysql` for MySQL.","type":"string","maxLength":2048},"database_branch_name":{"description":"The name of the PlanetScale database branch.","type":"string","maxLength":2048,"minLength":1},"database_name":{"description":"The name of the PlanetScale database.","type":"string","maxLength":2048,"minLength":1},"organization_name":{"description":"The name of the PlanetScale organization.","type":"string","maxLength":2048,"minLength":1},"provider":{"$ref":"#/definitions/hyperdrive_hyperdrive-integration-provider"},"scheme":{"$ref":"#/definitions/hyperdrive_hyperdrive-scheme"}},"required":["provider","organization_name","database_name","database_branch_name","scheme"],"title":"PlanetScale integration"},"hyperdrive_hyperdrive-caching-create":{"type":"object","anyOf":[{"$ref":"#/definitions/hyperdrive_hyperdrive-caching-create-disabled"},{"$ref":"#/definitions/hyperdrive_hyperdrive-caching-create-enabled"}]},"hyperdrive_hyperdrive-mtls":{"description":"mTLS configuration for the origin connection. Cannot be used with VPC Service origins; TLS must be managed on the VPC Service.","type":"object","properties":{"ca_certificate_id":{"description":"Define CA certificate ID obtained after uploading CA cert.","type":"string","examples":["00000000-0000-0000-0000-0000000000"]},"mtls_certificate_id":{"description":"Define mTLS certificate ID obtained after uploading client cert.","type":"string","examples":["00000000-0000-0000-0000-0000000000"]},"sslmode":{"description":"PostgreSQL accepts `require`, `verify-ca`, and `verify-full`. MySQL accepts `REQUIRED`, `VERIFY_CA`, and `VERIFY_IDENTITY`. The verify modes require a CA certificate; the require modes cannot be used with a CA certificate.","type":"string","examples":["verify-full"]}},"title":"mTLS"},"hyperdrive_hyperdrive-name":{"description":"The name of the Hyperdrive configuration. Used to identify the configuration in the Cloudflare dashboard and API.","type":"string","maxLength":2048,"examples":["example-hyperdrive"]},"hyperdrive_hyperdrive-origin-connection-limit":{"description":"The (soft) maximum number of connections the Hyperdrive is allowed to make to the origin database.\n\nMaximum allowed: 20 for free tier accounts, 100 for paid tier accounts.\nIf not specified, defaults to 20 for free tier and 60 for paid tier.\nCertain Cloudflare-managed origins may be permitted a higher limit.\nContact Cloudflare if you need a higher limit.\n","type":"integer","minimum":5,"examples":[60]},"hyperdrive_hyperdrive-database-full":{"type":"object","allOf":[{"$ref":"#/definitions/hyperdrive_hyperdrive-database"}],"required":["scheme","database","user","password"]},"hyperdrive_internet-origin":{"type":"object","properties":{"host":{"description":"Defines the publicly reachable hostname or IP of your origin database. Private, loopback, and link-local IP addresses are not allowed.","type":"string","examples":["database.example.com"]},"port":{"description":"Defines the port of your origin database. Defaults to 5432 for PostgreSQL or 3306 for MySQL if not specified.","type":"integer","maximum":65535,"minimum":1,"examples":[5432]}},"required":["host","port"],"title":"Public Database"},"hyperdrive_over-access-origin":{"type":"object","properties":{"access_client_id":{"description":"Defines the Client ID of the Access token to use when connecting to the origin database.","type":"string","examples":["0123456789abcdef0123456789abcdef.access"]},"access_client_secret":{"description":"Defines the Client Secret of the Access Token to use when connecting to the origin database. The API never returns this write-only value.","type":"string","examples":["0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"]},"host":{"description":"Defines the host (hostname or IP) of your origin database.","type":"string","examples":["database.example.com"]}},"required":["host","access_client_id","access_client_secret"],"title":"Access-protected Database behind Cloudflare Tunnel"},"hyperdrive_vpc-service-origin":{"description":"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.\n","type":"object","properties":{"service_id":{"description":"The identifier of the Workers VPC Service to connect through. Hyperdrive will egress through the specified VPC Service to reach the origin database.","type":"string","examples":["0123456789abcdef0123456789abcdef"]}},"required":["service_id"],"title":"Database reachable through a Workers VPC"},"hyperdrive_hyperdrive-integration-provider":{"description":"The database integration provider used by this operation.","type":"string","enum":["planetscale"],"examples":["planetscale"]},"hyperdrive_hyperdrive-scheme":{"description":"Specifies the URL scheme used to connect to your origin database.","type":"string","enum":["postgres","postgresql","mysql"]},"hyperdrive_hyperdrive-caching-create-disabled":{"type":"object","properties":{"disabled":{"type":"boolean","enum":[true]},"max_age":{"type":["integer","null"]},"stale_while_revalidate":{"type":["integer","null"]}},"not":{"anyOf":[{"properties":{"max_age":{"type":"integer"}},"required":["max_age"],"type":"object"},{"properties":{"stale_while_revalidate":{"type":"integer"}},"required":["stale_while_revalidate"],"type":"object"}]},"required":["disabled"],"title":"Caching disabled"},"hyperdrive_hyperdrive-caching-create-enabled":{"type":"object","properties":{"disabled":{"type":"boolean","enum":[false]},"max_age":{"description":"Specify the maximum duration (in seconds) items should persist in the cache. Defaults to 60 seconds if not specified.","type":["integer","null"],"maximum":3600,"minimum":1,"examples":[60]},"stale_while_revalidate":{"description":"Specify the number of seconds the cache may serve a stale response. Defaults to 15 seconds if not specified.","type":["integer","null"],"minimum":0,"examples":[15]}},"title":"Caching enabled"},"hyperdrive_hyperdrive-database":{"type":"object","properties":{"database":{"description":"Set the name of your origin database.","type":"string","maxLength":2048,"examples":["postgres"]},"password":{"description":"Set the password needed to access your origin database. The API never returns this write-only value.","type":"string","maxLength":2048},"scheme":{"$ref":"#/definitions/hyperdrive_hyperdrive-scheme"},"user":{"description":"Set the user of your origin database.","type":"string","maxLength":2048,"examples":["postgres"]}},"title":"Connection Options"}}},"name":"Create Hyperdrive","id":"cloudflare.create-hyperdrive","example":{"path":{"account_id":"023e105f4ecef8ad9ca31a8372d0c353"},"body":{"name":"example-hyperdrive","origin":{"scheme":"postgres","database":"postgres","user":"postgres","password":"example","host":"database.example.com","port":5432}}},"maxRequests":1,"summary":false}}