---
title: "POST /v1beta/properties/{propertiesId}/dataStreams/{dataStreamsId}/measurementProtocolSecrets"
method: POST
path: "/v1beta/properties/{propertiesId}/dataStreams/{dataStreamsId}/measurementProtocolSecrets"
tags: ["properties"]
---

# POST /v1beta/properties/{propertiesId}/dataStreams/{dataStreamsId}/measurementProtocolSecrets

`POST /v1beta/properties/{propertiesId}/dataStreams/{dataStreamsId}/measurementProtocolSecrets`

## Request

- Base URL: `https://analyticsadmin.googleapis.com`
- URL: `https://analyticsadmin.googleapis.com/v1beta/properties/{propertiesId}/dataStreams/{dataStreamsId}/measurementProtocolSecrets`
- Auth: OAuth 2 and OAuth 2
  - Implicit: `https://accounts.google.com/o/oauth2/auth`
  - Scopes: `https://www.googleapis.com/auth/analytics.edit`
  - Authorization code: `https://accounts.google.com/o/oauth2/auth`
  - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/analytics.edit`

Creates a measurement protocol secret.

## Path parameters

- `propertiesId` string, required
- `dataStreamsId` string, required

## Query parameters

- `$.xgafv` '1' | '2'
- `access_token` string
- `alt` 'json' | 'media' | 'proto'
- `callback` string
- `fields` string
- `key` string
- `oauth_token` string
- `prettyPrint` boolean
- `quotaUser` string
- `uploadType` string
- `upload_protocol` string

## Request body

- GoogleAnalyticsAdminV1betaMeasurementProtocolSecret: A secret value used for sending hits to Measurement Protocol.
  - `displayName` string: Required. Human-readable display name for this secret.
  - `name` string: Identifier. Resource name of this secret. This secret may be a child of any type of stream. Format: properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret}
  - `secretValue` string: Output only. The measurement protocol secret value. Pass this value to the api_secret field of the Measurement Protocol API when sending hits to this secret's parent property.

## Response `200`

Successful response

- GoogleAnalyticsAdminV1betaMeasurementProtocolSecret: A secret value used for sending hits to Measurement Protocol.
  - `displayName` string: Required. Human-readable display name for this secret.
  - `name` string: Identifier. Resource name of this secret. This secret may be a child of any type of stream. Format: properties/{property}/dataStreams/{dataStream}/measurementProtocolSecrets/{measurementProtocolSecret}
  - `secretValue` string: Output only. The measurement protocol secret value. Pass this value to the api_secret field of the Measurement Protocol API when sending hits to this secret's parent property.

---

[API](https://skmtc.dev/google/apis/analyticsadmin.md) - [All operations](https://skmtc.dev/google/apis/analyticsadmin/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/analyticsadmin/revisions/2f06698abda1?raw)
