Skip to main content
POST
https://{tenantDomain}/api/v2
/
organizations
/
{id}
/
discovery-domains
C#
using Auth0.ManagementApi;
using System.Threading.Tasks;
using Auth0.ManagementApi.Organizations;

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

        await client.Organizations.DiscoveryDomains.CreateAsync(
            id: "id",
            request: new CreateOrganizationDiscoveryDomainRequestContent {
                Domain = "domain"
            }
        );
    }

}
package com.example.usage;

import com.auth0.client.mgmt.ManagementApi;
import com.auth0.client.mgmt.resources.organizations.discoverydomains.requests.CreateOrganizationDiscoveryDomainRequestContent;

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

client.organizations().discoveryDomains().create(
"id",
CreateOrganizationDiscoveryDomainRequestContent
.builder()
.domain("domain")
.build()
);
}
}
<?php

namespace Example;

use Auth0\SDK\API\Management\Management;
use Auth0\SDK\API\Management\Organizations\DiscoveryDomains\Requests\CreateOrganizationDiscoveryDomainRequestContent;

$client = new Management(
token: '<token>',
);
$client->organizations->discoveryDomains->create(
'id',
new CreateOrganizationDiscoveryDomainRequestContent([
'domain' => 'domain',
]),
);
from auth0.management import ManagementClient

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

client.organizations.discovery_domains.create(
id="id",
domain="domain",
)
require "auth0"

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

client.organizations.discovery_domains.create(
id: "id",
domain: "domain"
)
curl --request POST \
--url https://{tenantDomain}/api/v2/organizations/{id}/discovery-domains \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"domain": "<string>",
"use_for_organization_discovery": true
}
'
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({domain: '<string>', use_for_organization_discovery: true})
};

fetch('https://{tenantDomain}/api/v2/organizations/{id}/discovery-domains', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
package main

import (
"fmt"
"strings"
"net/http"
"io"
)

func main() {

url := "https://{tenantDomain}/api/v2/organizations/{id}/discovery-domains"

payload := strings.NewReader("{\n \"domain\": \"<string>\",\n \"use_for_organization_discovery\": true\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
{
  "id": "<string>",
  "domain": "<string>",
  "verification_txt": "<string>",
  "verification_host": "<string>",
  "use_for_organization_discovery": true
}

Authorizations

Authorization
string
header
required

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

Path Parameters

id
string
required

ID of the organization.

Body

domain
string
required

The domain name to associate with the organization e.g. acme.com.

Required string length: 3 - 255
status
enum<string>

The verification status of the discovery domain.

Available options:
pending,
verified
use_for_organization_discovery
boolean

Indicates whether this domain should be used for organization discovery.

Response

Organization discovery domain successfully created.

id
string<organization-discovery-domain-id>
required

Organization discovery domain identifier.

domain
string
required

The domain name to associate with the organization e.g. acme.com.

Required string length: 3 - 255
Pattern: ^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9-]*[A-Za-z0-9])$
status
enum<string>
required

The verification status of the discovery domain.

Available options:
pending,
verified
verification_txt
string
required

A unique token generated for the discovery domain. This must be placed in a DNS TXT record at the location specified by the verification_host field to prove domain ownership.

verification_host
string
required

The full domain where the TXT record should be added.

use_for_organization_discovery
boolean

Indicates whether this domain should be used for organization discovery.