> ## Documentation Index
> Fetch the complete documentation index at: https://upstash-fix-issues-on-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Create a Redis Database (Global)

> This endpoint creates a new Redis database.

## Request Parameters

<ParamField body="name" type="string" required>
  Name of the database
</ParamField>

<ParamField body="region" type="string" default="global" required>
  Region of the database. Only valid option is `global`.
</ParamField>

<ParamField body="primary_region" type="string" required>
  Primary Region of the Global Database.

  Available regions: `us-east-1`, `us-west-1`, `us-west-2`, `eu-west-1`,
  `eu-central-1`, `ap-southeast-1`, `ap-southeast-2`, `sa-east-1`
</ParamField>

<ParamField body="read_regions" type="Array<string>">
  Array of Read Regions of
  the Database.

  Available regions: `us-east-1`, `us-west-1`, `us-west-2`, `eu-west-1`,
  `eu-central-1`, `ap-southeast-1`, `ap-southeast-2`, `sa-east-1`
</ParamField>

<ParamField body="tls" type="boolean" required>
  Set true to enable tls.
</ParamField>

## Response Parameters

<ResponseField name="database_id" type="string">
  ID of the created database
</ResponseField>

<ResponseField name="database_name" type="string">
  Name of the database
</ResponseField>

<ResponseField name="database_type" type="string">
  Type of the database in terms of pricing model(Free, Pay as You Go or
  Enterprise)
</ResponseField>

<ResponseField name="region" type="string">
  The region where database is hosted
</ResponseField>

<ResponseField name="port" type="int">
  Database port for clients to connect
</ResponseField>

<ResponseField name="creation_time" type="int">
  Creation time of the database as Unix time
</ResponseField>

<ResponseField name="state" type="string">
  State of database (active or deleted)
</ResponseField>

<ResponseField name="password" type="string">
  Password of the database
</ResponseField>

<ResponseField name="user_email" type="string">
  Email or team id of the owner of the database
</ResponseField>

<ResponseField name="endpoint" type="string">
  Endpoint URL of the database
</ResponseField>

<ResponseField name="tls" type="boolean">
  TLS/SSL is enabled or not
</ResponseField>

<RequestExample>
  ```shell curl
  curl -X POST \
    https://api.upstash.com/v2/redis/database \
    -u 'EMAIL:API_KEY' \
    -d '{"name":"myredis", "region":"global", "primary_region":"us-east-1", "read_regions":["us-west-1","us-west-2"], "tls": true}'
  ```

  ```python Python
  import requests

  data = '{"name":"myredis", "region":"global", "primary_region":"us-east-1", "read_regions":["us-west-1","us-west-2"], "tls":true}'

  response = requests.post('https://api.upstash.com/v2/redis/database', data=data, auth=('EMAIL', 'API_KEY'))
  response.content
  ```

  ```go Go
  client := &http.Client{}
  var data = strings.NewReader(`{
      "name":"myredis",
      "region":"global",
      "primary_region"":"us-east-1",
      "read_regions":["us-west-1","us-west-2"],
      "tls": true
  }`)
  req, err := http.NewRequest("POST", "https://api.upstash.com/v2/redis/database", data)
  if err != nil {
      log.Fatal(err)
  }
  req.SetBasicAuth("email", "api_key")
  resp, err := client.Do(req)
  if err != nil {
      log.Fatal(err)
  }
  bodyText, err := ioutil.ReadAll(resp.Body)
  if err != nil {
      log.Fatal(err)
  }
  fmt.Printf("%s\n", bodyText);
  ```
</RequestExample>

<ResponseExample>
  ```json 200 OK
  {
    "database_id": "93e3a3e-342c-4683-ba75-344c08ae143b",
    "database_name": "global-test",
    "database_type": "Pay as You Go",
    "region": "global",
    "type": "paid",
    "port": 32559,
    "creation_time": 1674596896,
    "state": "active",
    "password": "dd1803832a2746309e118373549e574d",
    "user_email": "support@upstash.com",
    "endpoint": "steady-stud-32559.upstash.io",
    "tls": false,
    "rest_token": "AX8vACQgOTMyY2UyYy00NjgzLWJhNzUtMzQ0YzA4YWUxNDNiZMyYTI3NDYzMDllMTE4MzczNTQ5ZTU3NGQ=",
    "read_only_rest_token": "An8vACQg2UtMzQyYy00NjgzLWJhNzUtMzQ0YzA4YBVsUsyn19xDnTAvjbsiq79GRDrURNLzIYIOk="
  }
  ```
</ResponseExample>
