---
updatedAt: 2026-03-01T18:52:50.000Z
agentTools:
  siteIndex: https://techdocs.akamai.com/llms.txt
  projectIndex: https://techdocs.akamai.com/datastream2/llms.txt
---

# Activate a stream (v2)

```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 streamId = "7050";

eg.auth({
    path: `/datastream-config-api/v2/streams/${streamId}/activate`,
    method: "PUT",
    headers: {
        "Content-Type": "application/json",
        "Accept": "application/json"
    }
});
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)
streamId = "7050"

path = '/datastream-config-api/v2/log/streams/{}/activate'.format(streamId)
headers = {
    "Content-Type": "application/json",
    "Accept": "application/json"
}

result = session.get(urljoin(baseurl, path), headers = headers)
print(result.status_code)
print(result.json())

```

```shell cURL
streamId="7050"

egcurl --eg-section default --request PUT \
  --url "https://$hostname/datastream-config-api/v2/streams/$streamId/activate" \
  --header "Accept: application/json" \
  --header "Content-Type: application/json"  \
  
```

```json Response Example
{
  "streamName": "DD Stream",
  "streamId": 7050,
  "streamVersion": 1,
  "groupId": 21484,
  "contractId": "2-FGHIJ",
  "properties": [
    {
      "propertyId": 349772,
      "propertyName": "example.com"
    },
    {
      "propertyId": 349770,
      "propertyName": "example.akamai.com"
    }
  ],
  "datasetFields": [
    {
      "datasetFieldId": 1000,
      "datasetFieldName": "CP code",
      "datasetFieldJsonKey": "cp"
    },
    {
      "datasetFieldId": 1002,
      "datasetFieldName": "Request ID",
      "datasetFieldJsonKey": "reqId"
    },
    {
      "datasetFieldId": 1023,
      "datasetFieldName": "Cookie",
      "datasetFieldJsonKey": "cookie"
    }
  ],
  "destination": {
    "path": "ds2-logs",
    "displayName": "S3Destination",
    "bucket": "datastream.akamai.com",
    "region": "ap-south-1",
    "destinationType": "S3",
    "compressLogs": true
  },
  "deliveryConfiguration": {
    "uploadFilePrefix": "logs",
    "uploadFileSuffix": "ds",
    "fieldDelimiter": "SPACE",
    "frequency": {
      "intervalInSeconds": 30
    },
    "format": "STRUCTURED"
  },
  "latestVersion": 1,
  "productId": "Dynamic_Site_Accelerator",
  "streamStatus": "ACTIVATING",
  "createdBy": "johndoe",
  "createdDate": "2022-02-05T13:31:30Z",
  "modifiedBy": "johndoe",
  "modifiedDate": "2022-02-05T13:31:30Z",
  "notificationEmails": [
    "useremail1@domain.com",
    "useremail2@domain.com"
  ],
  "collectMidgress": true
}
```

# Set up authorization



Before you can 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.

# Fetch stream details

<!-- node@10 -->
<!-- python@13 -->
<!-- shell@1 -->

Run the [List streams](https://techdocs.akamai.com/datastream2/reference/get-streams) and pick the `streamId` value of the stream whose latest version you want to activate on production.

# Form the URL

<!-- node@13 -->
<!-- python@15 -->
<!-- shell@4 -->

Inject the `streamId` value into the template URL.

# Call the API

<!-- node@13-14 -->
<!-- python@15 -->
<!-- shell@4 -->

Run PUT on the request URL.

Note that activating the stream takes approximately 60 minutes.

# Get the response



The response now lists the `streamStatus` as `ACTIVATING`.

You can use the `streamId` and `streamVersion` values from the response to deactivate the stream and stop collecting logs at any time. See the [Deactivate a stream](https://techdocs.akamai.com/datastream2/reference/put-stream-deactivate) operation.

# Enable DataStream in Property Manager



Follow the [Enable the DataStream behavior](https://techdocs.akamai.com/datastream2/docs/enable-datastream-behavior) procedure in Property Manager to start receiving logs in your destination from the active stream.