# TURN ## List TURN Keys `client.calls.turn.list(TURNListParamsparams, RequestOptionsoptions?): SinglePage` **get** `/accounts/{account_id}/calls/turn_keys` Lists all TURN keys in the Cloudflare account ### Parameters - `params: TURNListParams` - `account_id: string` The account identifier tag. ### Returns - `TURNListResponse` - `created?: string` The date and time the item was created. - `modified?: string` The date and time the item was last modified. - `name?: string` A short description of Calls app, not shown to end users. - `uid?: string` A Cloudflare-generated unique identifier for a item. ### Example ```node 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 turnListResponse of client.calls.turn.list({ account_id: '023e105f4ecef8ad9ca31a8372d0c353', })) { console.log(turnListResponse.uid); } ``` #### 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" } } ], "success": true, "result": [ { "created": "2014-01-02T02:20:00Z", "modified": "2014-01-02T02:20:00Z", "name": "production-realtime-app", "uid": "2a95132c15732412d22c1476fa83f27a" } ] } ``` ## Retrieve TURN key details `client.calls.turn.get(stringkeyId, TURNGetParamsparams, RequestOptionsoptions?): TURNGetResponse` **get** `/accounts/{account_id}/calls/turn_keys/{key_id}` Fetches details for a single TURN key. ### Parameters - `keyId: string` A Cloudflare-generated unique identifier for a item. - `params: TURNGetParams` - `account_id: string` The account identifier tag. ### Returns - `TURNGetResponse` - `created?: string` The date and time the item was created. - `modified?: string` The date and time the item was last modified. - `name?: string` A short description of Calls app, not shown to end users. - `uid?: string` A Cloudflare-generated unique identifier for a item. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const turn = await client.calls.turn.get('2a95132c15732412d22c1476fa83f27a', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(turn.uid); ``` #### 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" } } ], "success": true, "result": { "created": "2014-01-02T02:20:00Z", "modified": "2014-01-02T02:20:00Z", "name": "production-realtime-app", "uid": "2a95132c15732412d22c1476fa83f27a" } } ``` ## Create a new TURN key `client.calls.turn.create(TURNCreateParamsparams, RequestOptionsoptions?): TURNCreateResponse` **post** `/accounts/{account_id}/calls/turn_keys` Creates a new Cloudflare Calls TURN key. ### Parameters - `params: TURNCreateParams` - `account_id: string` Path param: The account identifier tag. - `name?: string` Body param: A short description of a TURN key, not shown to end users. ### Returns - `TURNCreateResponse` - `created?: string` The date and time the item was created. - `key?: string` Bearer token - `modified?: string` The date and time the item was last modified. - `name?: string` A short description of a TURN key, not shown to end users. - `uid?: string` A Cloudflare-generated unique identifier for a item. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const turn = await client.calls.turn.create({ account_id: '023e105f4ecef8ad9ca31a8372d0c353' }); console.log(turn.uid); ``` #### 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" } } ], "success": true, "result": { "created": "2014-01-02T02:20:00Z", "key": "66bcf64aa8907b9f9d90ac17746a77ce394c393b92b3916633dc02846e608ad4", "modified": "2014-01-02T02:20:00Z", "name": "my-turn-key", "uid": "2a95132c15732412d22c1476fa83f27a" } } ``` ## Edit TURN key details `client.calls.turn.update(stringkeyId, TURNUpdateParamsparams, RequestOptionsoptions?): TURNUpdateResponse` **put** `/accounts/{account_id}/calls/turn_keys/{key_id}` Edit details for a single TURN key. ### Parameters - `keyId: string` A Cloudflare-generated unique identifier for a item. - `params: TURNUpdateParams` - `account_id: string` Path param: The account identifier tag. - `name?: string` Body param: A short description of a TURN key, not shown to end users. ### Returns - `TURNUpdateResponse` - `created?: string` The date and time the item was created. - `modified?: string` The date and time the item was last modified. - `name?: string` A short description of Calls app, not shown to end users. - `uid?: string` A Cloudflare-generated unique identifier for a item. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const turn = await client.calls.turn.update('2a95132c15732412d22c1476fa83f27a', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(turn.uid); ``` #### 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" } } ], "success": true, "result": { "created": "2014-01-02T02:20:00Z", "modified": "2014-01-02T02:20:00Z", "name": "production-realtime-app", "uid": "2a95132c15732412d22c1476fa83f27a" } } ``` ## Delete TURN key `client.calls.turn.delete(stringkeyId, TURNDeleteParamsparams, RequestOptionsoptions?): TURNDeleteResponse` **delete** `/accounts/{account_id}/calls/turn_keys/{key_id}` Deletes a TURN key from Cloudflare Calls ### Parameters - `keyId: string` A Cloudflare-generated unique identifier for a item. - `params: TURNDeleteParams` - `account_id: string` The account identifier tag. ### Returns - `TURNDeleteResponse` - `created?: string` The date and time the item was created. - `modified?: string` The date and time the item was last modified. - `name?: string` A short description of Calls app, not shown to end users. - `uid?: string` A Cloudflare-generated unique identifier for a item. ### Example ```node import Cloudflare from 'cloudflare'; const client = new Cloudflare({ apiToken: process.env['CLOUDFLARE_API_TOKEN'], // This is the default and can be omitted }); const turn = await client.calls.turn.delete('2a95132c15732412d22c1476fa83f27a', { account_id: '023e105f4ecef8ad9ca31a8372d0c353', }); console.log(turn.uid); ``` #### 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" } } ], "success": true, "result": { "created": "2014-01-02T02:20:00Z", "modified": "2014-01-02T02:20:00Z", "name": "production-realtime-app", "uid": "2a95132c15732412d22c1476fa83f27a" } } ``` ## Domain Types ### TURN List Response - `TURNListResponse` - `created?: string` The date and time the item was created. - `modified?: string` The date and time the item was last modified. - `name?: string` A short description of Calls app, not shown to end users. - `uid?: string` A Cloudflare-generated unique identifier for a item. ### TURN Get Response - `TURNGetResponse` - `created?: string` The date and time the item was created. - `modified?: string` The date and time the item was last modified. - `name?: string` A short description of Calls app, not shown to end users. - `uid?: string` A Cloudflare-generated unique identifier for a item. ### TURN Create Response - `TURNCreateResponse` - `created?: string` The date and time the item was created. - `key?: string` Bearer token - `modified?: string` The date and time the item was last modified. - `name?: string` A short description of a TURN key, not shown to end users. - `uid?: string` A Cloudflare-generated unique identifier for a item. ### TURN Update Response - `TURNUpdateResponse` - `created?: string` The date and time the item was created. - `modified?: string` The date and time the item was last modified. - `name?: string` A short description of Calls app, not shown to end users. - `uid?: string` A Cloudflare-generated unique identifier for a item. ### TURN Delete Response - `TURNDeleteResponse` - `created?: string` The date and time the item was created. - `modified?: string` The date and time the item was last modified. - `name?: string` A short description of Calls app, not shown to end users. - `uid?: string` A Cloudflare-generated unique identifier for a item.