---
title: Create a TURN key
---

[Skip to content](#_top)

[API Reference](https://developers.cloudflare.com/api/go)

[Calls](https://developers.cloudflare.com/api/go/resources/calls)

[TURN](https://developers.cloudflare.com/api/go/resources/calls/subresources/turn)

Copy Markdown

Open in **Claude**Open in **ChatGPT**Open in **Cursor**

---

**Copy Markdown****View as Markdown**

# Create a TURN key

client.Calls.TURN.New(ctx, params) (\*[TURNNewResponse](<https://developers.cloudflare.com/api/go/resources/calls#(resource)%20calls.turn%20%3E%20(model)%20TURNNewResponse%20%3E%20(schema)>), error)

POST/accounts/{account\_id}/calls/turn\_keys

Creates a new Realtime TURN key.

##### Security

API Token

The preferred authorization scheme for interacting with the Cloudflare API. [Create a token](https://developers.cloudflare.com/fundamentals/api/get-started/create-token/).

**Example:**`Authorization: Bearer Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY`

##### Accepted Permissions (at least one required)

`Calls Write`

##### ParametersExpand Collapse

<details>

<summary>

params TURNNewParams

</summary>

AccountID param.Field\[string]

Path param: The account identifier tag.

maxLength32

<a href="#(resource)%20calls.turn%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20account_id">Link to this property</a>

Name param.Field\[string]Optional

Body param: A short description of a TURN key, not shown to end users.

<a href="#(resource)%20calls.turn%20%3E%20(method)%20create%20%3E%20(params)%20default%20%3E%20(param)%20name">Link to this property</a>

</details>

[Link to this property](<#(resource)%20calls.turn%20%3E%20(method)%20create%20%3E%20(params)%20default>)

##### ReturnsExpand Collapse

<details>

<summary>

type TURNNewResponse struct{…}

</summary>

Created Time

The date and time the item was created.

formatdate-time

<a href="#(resource)%20calls.turn%20%3E%20(model)%20TURNNewResponse%20%3E%20(schema)%20%3E%20(property)%20created">Link to this property</a>

Key string

Bearer token

maxLength64

minLength64

<a href="#(resource)%20calls.turn%20%3E%20(model)%20TURNNewResponse%20%3E%20(schema)%20%3E%20(property)%20key">Link to this property</a>

Modified Time

The date and time the item was last modified.

formatdate-time

<a href="#(resource)%20calls.turn%20%3E%20(model)%20TURNNewResponse%20%3E%20(schema)%20%3E%20(property)%20modified">Link to this property</a>

Name string

A short description of a TURN key, not shown to end users.

<a href="#(resource)%20calls.turn%20%3E%20(model)%20TURNNewResponse%20%3E%20(schema)%20%3E%20(property)%20name">Link to this property</a>

UID string

A Cloudflare-generated unique identifier for a item.

maxLength32

minLength32

<a href="#(resource)%20calls.turn%20%3E%20(model)%20TURNNewResponse%20%3E%20(schema)%20%3E%20(property)%20uid">Link to this property</a>

</details>

[Link to this property](<#(resource)%20calls.turn%20%3E%20(model)%20TURNNewResponse%20%3E%20(schema)>)

### Create a TURN key

Go

HTTPTypeScriptPythonGoTerraform

```
package main

import (
  "context"
  "fmt"

  "github.com/cloudflare/cloudflare-go"
  "github.com/cloudflare/cloudflare-go/calls"
  "github.com/cloudflare/cloudflare-go/option"
)

func main() {
  client := cloudflare.NewClient(
    option.WithAPIToken("Sn3lZJTBX6kkg7OdcBUAxOO963GEIyGQqnFTOFYY"),
  )
  turn, err := client.Calls.TURN.New(context.TODO(), calls.TURNNewParams{
    AccountID: cloudflare.F("023e105f4ecef8ad9ca31a8372d0c353"),
  })
  if err != nil {
    panic(err.Error())
  }
  fmt.Printf("%+v\n", turn.UID)
}
```

200 example

```
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "created": "2014-01-02T02:20:00Z",
    "key": "66bcf64aa8907b9f9d90ac17746a77ce394c393b92b3916633dc02846e608ad4",
    "modified": "2014-01-02T02:20:00Z",
    "name": "my-turn-key",
    "uid": "2a95132c15732412d22c1476fa83f27a"
  }
}
```

##### Returns Examples

200 example

```
{
  "errors": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "messages": [
    {
      "code": 1000,
      "message": "message",
      "documentation_url": "documentation_url",
      "source": {
        "pointer": "pointer"
      }
    }
  ],
  "success": true,
  "result": {
    "created": "2014-01-02T02:20:00Z",
    "key": "66bcf64aa8907b9f9d90ac17746a77ce394c393b92b3916633dc02846e608ad4",
    "modified": "2014-01-02T02:20:00Z",
    "name": "my-turn-key",
    "uid": "2a95132c15732412d22c1476fa83f27a"
  }
}
```