---
updatedAt: 2026-03-01T18:56:35.000Z
agentTools:
  siteIndex: https://techdocs.akamai.com/llms.txt
  projectIndex: https://techdocs.akamai.com/edgekv/llms.txt
---

# Create a namespace

```curl cURL
network="staging"

egcurl --eg-section default --request POST \

  --url "https://$hostname/edgekv/v1/networks/$network/namespaces" \
  --header "Accept: application/json" \
  --header "Content-Type: application/json" \
  --data '
{
    "geoLocation": "US"
    "namespace": "marketing",
    "retentionInSeconds": 0
    "groupId": 4284
}'
```

```node Node
const EdgeGrid = require("akamai-edgegrid");
const os = require("os");
const edgercPath = os.homedir + "/.edgerc.txt";
const edgercSection = "default";
const eg = new EdgeGrid({
    path: edgercPath,
    section: edgercSection
});

const network = "staging";

eg.auth({
    path: `/edgekv/v1/networks/${network}/namespaces`,
    method: "POST",
    headers: {
        "Content-Type": "application/json",
        "Accept": "application/json"
    },
    body: {
        "geoLocation": "US",  
        "namespace": "marketing",
        "retentionInSeconds": 0,
        "groupId": 4282
    }
});
eg.send(function (error, response, body) {
    console.log(body);
});
```

```python Python
import requests
from akamai.edgegrid import EdgeGridAuth, EdgeRc
from urllib.parse import urljoin

edgerc = EdgeRc('~/.edgerc.txt')
section = 'default'
baseurl = 'https://%s' % edgerc.get(section, 'host')

session = requests.Session()
session.auth = EdgeGridAuth.from_edgerc(edgerc, section)
network = "staging"

path = '/edgekv/v1/networks/{}/namespaces'.format(network)
headers = {
    "Content-Type": "application/json",
    "Accept": "application/json"}

payload = {
    "geoLocation": "US"  
    "namespace": "marketing",
    "retentionInSeconds": 0
    "groupId": 4284
}

result = session.post(urljoin(baseurl, path), headers=headers, json=payload)
print(result.status_code)
print(result.json())
```

```json Response Example
{
    "geoLocation": "US",
    "namespace": "marketing",
    "retentionInSeconds": 0,
    "groupId": 4284
}
```

# Set up authorization

<!-- curl@3 -->
<!-- node@1-12 -->
<!-- python@1-12 -->

Before you can use this API, you need to [Create authentication credentials](https://techdocs.akamai.com/developer/docs/set-up-authentication-credentials). 

Then, you can use these code samples to apply the token values to your requests.

# Select a network

<!-- curl@1 -->
<!-- node@10 -->
<!-- python@11 -->

Specify the network where you want to create the namespace. It can be either `staging` or `production`.

# Set the geLocation

<!-- curl@10 -->
<!-- node@20 -->
<!-- python@19 -->

You can optionally specify the geoLocation on the `PRODUCTION` network.

The `geoLocation` defaults to `US` on both the `STAGING` and `PRODUCTION` networks. There are additional options available only on the `PRODUCTION` network. Refer to the [EdgeKV Guide](https://techdocs.akamai.com/edgekv/docs/edgekv-data-model#namespace) for more information.

# Set a name

<!-- curl@11 -->
<!-- node@21 -->
<!-- python@20 -->

Specify a name for your namespace. This value is used as `namespaceId` in later operations.

# Set a retention period

<!-- curl@12 -->
<!-- node@22 -->
<!-- python@21 -->

Specify a retention period for data in this namespace in seconds.

You can also set `0` for an indefinite number of seconds.

# Set a groupId

<!-- curl@13 -->
<!-- node@23 -->
<!-- python@22 -->

To run this operation, you first need to run the [List permission groups](https://techdocs.akamai.com/edgekv/reference/get-groups) operation, and pick a `groupId` value.

You can also use a value of 0 to make the namespace available to all Akamai access groups on the account with EdgeKV capabilities.

# Form the URL

<!-- curl@5 -->
<!-- node@13 -->
<!-- python@13 -->

Inject the `network`, `geoLocation`, `namespace`, and `retentionInSeconds` values into the request URL path.

# Call the API

<!-- curl@0-100 -->
<!-- node@0-100 -->
<!-- python@0-100 -->

Call POST on the request URL, providing the body request object.

# Review the response

<!-- curl@0 -->
<!-- node@0 -->
<!-- python@0 -->

The response returns a `namespace` object.