Creates a new metric integration configuration identified by a unique ID.
- Project Owner
Path parameters
-
Unique 24-hexadecimal digit string that identifies your project. Use the /groups endpoint to retrieve all projects to which the authenticated user has access.
NOTE: Groups and projects are synonymous terms. Your group id is the same as your project id. For existing groups, your group/project id remains the same. The resource and corresponding endpoints use the term groups.
Format should match the following pattern:
^([a-f0-9]{24})$.
Query parameters
-
Flag that indicates whether Application wraps the response in an
envelopeJSON object. Some API clients cannot access the HTTP response headers or status code. To remediate this, set envelope=true in the query. Endpoints that return a list of results use the results object as an envelope. Application adds the status parameter to the response body.Default value is
false. -
Flag that indicates whether the response body should be in the prettyprint format.
Default value is
false.Prettyprint
Body
Required
Metric integration configuration to create.
-
The temporality to send to the metric integration.
Values are
DELTAorCUMULATIVE. -
Authentication method the integration uses when exporting metrics to the endpoint.
HEADERauthenticates with the static HTTP headers provided in theheadersfield, which must be set when this value is used.OAUTH2acquires a bearer token from an OAuth 2.0 token endpoint using theoauthfield.Values are
HEADERorOAUTH2. -
OpenTelemetry collector endpoint URL. Must use HTTPS.
Maximum length is
2048. -
HTTP headers for authentication and configuration. Total size limit 2KB. Required when
authTypeisHEADER.At least
1but not more than10elements. -
Type of metric integration. Identifies which protocol will be used for the integration. This value cannot be modified after the integration is created.
Value is
OTEL. -
Array of metric categories to export. Determines which types of metrics are sent to the integration.
At least
1but not more than30elements. Values areATLAS_STREAM_PROCESSING,MONGODB_METRICS, orHARDWARE_METRICS. -
OAuth 2.0 client credentials configuration. Required when
authTypeisOAUTH2. Secrets are never returned. -
The provider type for the metric integration. Identifies the third-party service provider.
Values are
CUSTOM,DATADOG,DYNATRACE, orNEW_RELIC.
atlas api metricIntegrations createGroupMetricIntegration --help
import (
"os"
"context"
"log"
sdk "go.mongodb.org/atlas-sdk/v20250312001/admin"
)
func main() {
ctx := context.Background()
clientID := os.Getenv("MONGODB_ATLAS_CLIENT_ID")
clientSecret := os.Getenv("MONGODB_ATLAS_CLIENT_SECRET")
// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth
client, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))
if err != nil {
log.Fatalf("Error: %v", err)
}
params = &sdk.CreateGroupMetricIntegrationApiParams{}
sdkResp, httpResp, err := client.MetricIntegrationsApi.
CreateGroupMetricIntegrationWithParams(ctx, params).
Execute()
}
curl --include --header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header "Accept: application/vnd.atlas.2025-03-12+json" \
--header "Content-Type: application/json" \
-X POST "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/metricIntegrations" \
-d '{ <Payload> }'
curl --user "${PUBLIC_KEY}:${PRIVATE_KEY}" \
--digest --include \
--header "Accept: application/vnd.atlas.2025-03-12+json" \
--header "Content-Type: application/json" \
-X POST "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/metricIntegrations" \
-d '{ <Payload> }'
{
"aggregationTemporality": "DELTA",
"authType": "HEADER",
"endpoint": "https://otel-collector.example.com:4318/v1/metrics",
"headers": [
{
"name": "Authorization",
"value": "Bearer token123"
}
],
"integrationType": "OTEL",
"metricSelection": [
"ATLAS_STREAM_PROCESSING"
],
"oauth": {
"clientAuthMethod": "CLIENT_SECRET",
"clientId": "atlas-otel",
"clientSecret": "string",
"scopes": [
"string"
],
"tokenEndpoint": "https://idp.example.com/oauth2/token",
"tokenRequestParams": {
"resource": "https://otel.example.com/metrics"
}
},
"providerType": "CUSTOM"
}
# Headers
# Payload
{
"aggregationTemporality": "DELTA",
"authType": "HEADER",
"endpoint": "https://otel-collector.example.com:4318/v1/metrics",
"headersRedacted": [
{
"name": "Authorization",
"value": "********oken"
}
],
"integrationType": "OTEL",
"metricIntegrationId": "507f1f77bcf86cd799439011",
"metricSelection": [
"ATLAS_STREAM_PROCESSING"
],
"oauth": {
"clientAuthMethod": "CLIENT_SECRET",
"clientId": "string",
"scopes": [
"string"
],
"signingKeyInfo": {
"algorithm": "RS256",
"createdAt": "2026-05-04T09:42:00Z",
"jwksUri": "https://cloud.mongodb.com/api/keys/clientJwks/9f6c2a1e-8b3d-4e7a-a2c5-1f0e9d41d000",
"kid": "string"
},
"tokenEndpoint": "string",
"tokenRequestParams": {
"additionalProperty1": "string",
"additionalProperty2": "string"
}
},
"providerType": "CUSTOM"
}
{
"detail": "(This is just an example, the exception may not be related to this endpoint) No provider AWS exists.",
"error": 400,
"errorCode": "VALIDATION_ERROR",
"reason": "Bad Request"
}
{
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"error": 401,
"errorCode": "NOT_ORG_GROUP_CREATOR",
"reason": "Unauthorized"
}
{
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"error": 403,
"errorCode": "CANNOT_CHANGE_GROUP_NAME",
"reason": "Forbidden"
}
{
"detail": "(This is just an example, the exception may not be related to this endpoint) Cannot find resource AWS",
"error": 404,
"errorCode": "RESOURCE_NOT_FOUND",
"reason": "Not Found"
}
{
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"error": 429,
"errorCode": "RATE_LIMITED",
"reason": "Too Many Requests"
}
{
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"error": 500,
"errorCode": "UNEXPECTED_ERROR",
"reason": "Internal Server Error"
}