> ## Documentation Index
> Fetch the complete documentation index at: https://developers.telnyx.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a SQL database

> Creates a new SQL database. Provisioning is asynchronous: the database is returned with status `pending` and becomes usable once it reaches `provision_ok`.



## OpenAPI

````yaml /openapi/source/external/edge-compute/edge-compute.json post /storage/sqldbs
openapi: 3.1.0
info:
  description: >-
    Edge Compute storage: KV namespaces and keys, SQL databases, and CloudFS
    filesystems.
  title: Edge Compute API
  contact: {}
  version: '1.0'
  x-endpoint-cost: light
  x-latency-category: responsive
servers:
  - url: https://api.telnyx.com/v2
    description: Production server
security:
  - bearerAuth: []
tags:
  - name: kv namespaces
    description: Manage KV storage namespaces
  - name: kv keys
    description: Read and write keys within a KV namespace
  - name: sql databases
    description: Manage SQL databases and run SQL against them
  - name: cloudfs filesystems
    description: >-
      Manage CloudFS filesystems — JuiceFS-compatible filesystems backed by
      Telnyx Cloud Storage
paths:
  /storage/sqldbs:
    post:
      tags:
        - sql databases
      summary: Create a SQL database
      description: >-
        Creates a new SQL database. Provisioning is asynchronous: the database
        is returned with status `pending` and becomes usable once it reaches
        `provision_ok`.
      operationId: CreateSqlDatabase
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateSqlDatabaseRequest'
        description: SQL database creation request
        required: true
      responses:
        '201':
          description: SQL database created successfully (status `pending`)
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SqlDatabaseResponseWrapper'
        '400':
          description: Bad request — the request body is malformed
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
        '409':
          description: >-
            Conflict — a database with this name already exists for your
            organization
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
        '422':
          description: Validation error — `name` is missing or not a valid database name
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Errors'
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GenericErrorResponse'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Telnyx from 'telnyx';


            const client = new Telnyx({
              apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
            });


            const SqlDatabaseResponseWrapper = await
            client.storage.sqldbs.create({
              name: 'my-database',
            });


            console.log(SqlDatabaseResponseWrapper.data);
        - lang: Python
          source: |
            import os
            from telnyx import Telnyx

            client = Telnyx(
                api_key=os.environ.get("TELNYX_API_KEY"),  # This is the default and can be omitted
            )
            sql_database_response_wrapper = client.storage.sqldbs.create(
                name="my-database",
            )
            print(sql_database_response_wrapper.data)
        - lang: Go
          source: "package main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\n\t\"github.com/team-telnyx/telnyx-go\"\n\t\"github.com/team-telnyx/telnyx-go/option\"\n)\n\nfunc main() {\n\tclient := telnyx.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"),\n\t)\n\tsqldb, err := client.Storage.Sqldbs.New(\n\t\tcontext.TODO(),\n\t\ttelnyx.StorageSqldbNewParams{\n\t\t\tName: \"my-database\",\n\t\t},\n\t)\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", sqldb.Data)\n}\n"
        - lang: Java
          source: |-
            package com.telnyx.sdk.example;

            import com.telnyx.sdk.client.TelnyxClient;
            import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
            import com.telnyx.sdk.models.storage.sqldbs.SqldbCreateParams;

            public final class Main {
                private Main() {}

                public static void main(String[] args) {
                    TelnyxClient client = TelnyxOkHttpClient.fromEnv();

                    SqldbCreateParams params = SqldbCreateParams.builder()
                        .name("my-database")
                        .build();
                    var response = client.storage().sqldbs().create(params);
                }
            }
        - lang: Ruby
          source: >-
            require "telnyx"


            telnyx = Telnyx::Client.new(api_key: "My API Key")


            sql_database_response_wrapper = telnyx.storage.sqldbs.create(name:
            "my-database")


            puts(sql_database_response_wrapper)
        - lang: PHP
          source: >-
            <?php


            require_once dirname(__DIR__) . '/vendor/autoload.php';


            use Telnyx\Client;

            use Telnyx\Core\Exceptions\APIException;


            $client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API
            Key');


            try {
              $sql_database_response_wrapper = $client->storage->sqldbs->create(
                name: 'my-database',
              );

              var_dump($sql_database_response_wrapper);
            } catch (APIException $e) {
              echo $e->getMessage();
            }
        - lang: CLI
          source: |-
            telnyx storage:sqldbs create \
              --api-key 'My API Key' \
              --name my-database
components:
  schemas:
    CreateSqlDatabaseRequest:
      type: object
      properties:
        name:
          type: string
          description: >-
            Database name. Lowercase letters, numbers, and hyphens only; must
            start and end with a letter or number.
          pattern: ^[a-z0-9]([a-z0-9-]*[a-z0-9])?$
          minLength: 1
          maxLength: 255
          example: my-database
      required:
        - name
    SqlDatabaseResponseWrapper:
      type: object
      properties:
        data:
          $ref: '#/components/schemas/SqlDatabase'
    Errors:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Error'
    GenericErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/Error'
    SqlDatabase:
      type: object
      properties:
        record_type:
          type: string
          example: storage_sqldb
        id:
          type: string
          format: uuid
          example: 550e8400-e29b-41d4-a716-446655440000
        name:
          type: string
          example: my-database
        status:
          type: string
          description: >-
            Provisioning status. A database is usable once `status` is
            `provision_ok`. Once deletion completes, the database no longer
            appears in the API.
          enum:
            - pending
            - provision_ok
            - provision_failed
            - deleting
            - delete_failed
          example: provision_ok
        created_at:
          type: string
          format: date-time
          example: '2026-06-18T14:48:17Z'
        updated_at:
          type: string
          format: date-time
          example: '2026-06-18T14:48:17Z'
    Error:
      type: object
      properties:
        code:
          type: string
          example: '10005'
        detail:
          type: string
          example: The requested function does not exist or you don't have access to it
        meta:
          $ref: '#/components/schemas/ErrorMeta'
        source:
          $ref: '#/components/schemas/ErrorSource'
        title:
          type: string
          example: Function not found
    ErrorMeta:
      type: object
      properties:
        url:
          type: string
          example: https://docs.telnyx.com/api/errors/10005
    ErrorSource:
      type: object
      properties:
        parameter:
          type: string
          example: id
        pointer:
          type: string
          example: /id
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````