Skip to main content
POST
https://{tenantDomain}/api/v2
/
event-streams
C#
using Auth0.ManagementApi;
using System.Threading.Tasks;

public partial class Examples
{
    public async Task Example() {
        var client = new ManagementClient(
            token: "<token>"
        );

        await client.EventStreams.CreateAsync(
            new CreateEventStreamWebHookRequestContent {
                Destination = new EventStreamWebhookDestination {
                    Type = "webhook",
                    Configuration = new EventStreamWebhookConfiguration {
                        WebhookEndpoint = "webhook_endpoint",
                        WebhookAuthorization = new EventStreamWebhookBasicAuth {
                            Method = "basic",
                            Username = "username"
                        }
                    }
                }
            }
        );
    }

}
package example

import (
    context "context"

    management "github.com/auth0/go-auth0/management/management"
    client "github.com/auth0/go-auth0/management/management/client"
    option "github.com/auth0/go-auth0/management/management/option"
)

func do() {
    client := client.NewClient(
        option.WithToken(
            "<token>",
        ),
    )
    request := &management.EventStreamsCreateRequest{
        CreateEventStreamWebHookRequestContent: &management.CreateEventStreamWebHookRequestContent{
            Destination: &management.EventStreamWebhookDestination{
                Type: management.EventStreamWebhookDestinationTypeEnum(
                    "webhook",
                ),
                Configuration: &management.EventStreamWebhookConfiguration{
                    WebhookEndpoint: "webhook_endpoint",
                    WebhookAuthorization: &management.EventStreamWebhookAuthorizationResponse{
                        EventStreamWebhookBasicAuth: &management.EventStreamWebhookBasicAuth{
                            Method: management.EventStreamWebhookBasicAuthMethodEnum(
                                "basic",
                            ),
                            Username: "username",
                        },
                    },
                },
            },
        },
    }
    client.EventStreams.Create(
        context.TODO(),
        request,
    )
}
package com.example.usage;

import com.auth0.client.mgmt.ManagementApi;
import com.auth0.client.mgmt.resources.eventstreams.types.EventStreamsCreateRequest;
import com.auth0.client.mgmt.types.CreateEventStreamWebHookRequestContent;
import com.auth0.client.mgmt.types.EventStreamWebhookAuthorizationResponse;
import com.auth0.client.mgmt.types.EventStreamWebhookBasicAuth;
import com.auth0.client.mgmt.types.EventStreamWebhookConfiguration;
import com.auth0.client.mgmt.types.EventStreamWebhookDestination;

public class Example {
    public static void main(String[] args) {
        ManagementApi client = ManagementApi
            .builder()
            .token("<token>")
            .build();

        client.eventStreams().create(
            EventStreamsCreateRequest.of(
                CreateEventStreamWebHookRequestContent
                    .builder()
                    .destination(
                        EventStreamWebhookDestination
                            .builder()
                            .type("webhook")
                            .configuration(
                                EventStreamWebhookConfiguration
                                    .builder()
                                    .webhookEndpoint("webhook_endpoint")
                                    .webhookAuthorization(
                                        EventStreamWebhookAuthorizationResponse.of(
                                            EventStreamWebhookBasicAuth
                                                .builder()
                                                .method("basic")
                                                .username("username")
                                                .build()
                                        )
                                    )
                                    .build()
                            )
                            .build()
                    )
                    .build()
            )
        );
    }
}
<?php

namespace Example;

use Auth0\SDK\API\Management\Management;
use Auth0\SDK\API\Management\Types\CreateEventStreamWebHookRequestContent;
use Auth0\SDK\API\Management\Types\EventStreamWebhookDestination;
use Auth0\SDK\API\Management\Types\EventStreamWebhookConfiguration;
use Auth0\SDK\API\Management\Types\EventStreamWebhookBasicAuth;

$client = new Management(
    token: '<token>',
);
$client->eventStreams->create(
    new CreateEventStreamWebHookRequestContent([
        'destination' => new EventStreamWebhookDestination([
            'type' => 'webhook',
            'configuration' => new EventStreamWebhookConfiguration([
                'webhookEndpoint' => 'webhook_endpoint',
                'webhookAuthorization' => new EventStreamWebhookBasicAuth([
                    'method' => 'basic',
                    'username' => 'username',
                ]),
            ]),
        ]),
    ]),
);
from auth0.management import ManagementClient, CreateEventStreamWebHookRequestContent, EventStreamWebhookDestination, EventStreamWebhookConfiguration, EventStreamWebhookBasicAuth

client = ManagementClient(
    token="<token>",
)

client.event_streams.create(
    request=CreateEventStreamWebHookRequestContent(
        destination=EventStreamWebhookDestination(
            type="webhook",
            configuration=EventStreamWebhookConfiguration(
                webhook_endpoint="webhook_endpoint",
                webhook_authorization=EventStreamWebhookBasicAuth(
                    method="basic",
                    username="username",
                ),
            ),
        ),
    ),
)
require "auth0"

client = Auth0::Management.new(token: "<token>")

client.event_streams.create(destination: {
  type: "webhook",
  configuration: {
    webhook_endpoint: "webhook_endpoint",
    webhook_authorization: {
      method: "basic",
      username: "username"
    }
  }
})
import { ManagementClient } from "auth0";

async function main() {
    const client = new ManagementClient({
        token: "<token>",
    });
    await client.eventStreams.create({
        destination: {
            type: "webhook",
            configuration: {
                webhookEndpoint: "webhook_endpoint",
                webhookAuthorization: {
                    method: "basic",
                    username: "username",
                },
            },
        },
    });
}
main();
import { ManagementClient } from "auth0";

async function main() {
    const client = new ManagementClient({
        token: "<token>",
    });
    await client.eventStreams.create({
        destination: {
            type: "webhook",
            configuration: {
                webhookEndpoint: "webhook_endpoint",
                webhookAuthorization: {
                    method: "basic",
                    username: "username",
                },
            },
        },
    });
}
main();
curl --request POST \
  --url https://{tenantDomain}/api/v2/event-streams \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "destination": {
    "type": "webhook",
    "configuration": {
      "webhook_endpoint": "<string>",
      "webhook_authorization": {
        "method": "basic",
        "username": "<string>"
      }
    }
  },
  "name": "<string>",
  "subscriptions": [
    {
      "event_type": "<string>"
    }
  ]
}
'
{
  "id": "<string>",
  "name": "<string>",
  "subscriptions": [
    {
      "event_type": "<string>"
    }
  ],
  "destination": {
    "type": "webhook",
    "configuration": {
      "webhook_endpoint": "<string>",
      "webhook_authorization": {
        "method": "basic",
        "username": "<string>"
      }
    }
  },
  "created_at": "2023-11-07T05:31:56Z",
  "updated_at": "2023-11-07T05:31:56Z"
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

destination
object
required
name
string

Name of the event stream.

Required string length: 1 - 128
subscriptions
object[]

List of event types subscribed to in this stream.

Minimum array length: 1
status
enum<string>

Indicates whether the event stream is actively forwarding events.

Available options:
enabled,
disabled
Maximum string length: 8

Response

Event Stream stream created successfully.

id
string<event-stream-id>

Unique identifier for the event stream.

Required string length: 26
name
string

Name of the event stream.

Required string length: 1 - 128
subscriptions
object[]

List of event types subscribed to in this stream.

Minimum array length: 1
destination
object
status
enum<string>

Indicates whether the event stream is actively forwarding events.

Available options:
enabled,
disabled
Maximum string length: 8
created_at
string<date-time>

Timestamp when the event stream was created.

updated_at
string<date-time>

Timestamp when the event stream was last updated.