# Verify managed domain

- Operation ID: `verifyManagedDomainUsingPOST`
- HTTP method: `POST`
- Path: `/uauth/managed-domains/verification`
- [Human-readable API reference](https://hub.synerise.com/api-reference/identity-and-access-management#tag/Directory/operation/verifyManagedDomainUsingPOST)

## Self-contained OpenAPI method

The fenced document below contains this method's documentation and all of its local references. It is self-contained; no category or master specification fetch is required.

```yaml
openapi: 3.0.0
info:
  title: Synerise Public API
  version: 1.9.1
paths:
  /uauth/managed-domains/verification:
    post:
      tags:
        - Directory
      summary: Verify managed domain
      description: |
        Verify a managed domain to assign it to a workspace. All users who belong to the domain are managed by that workspace.

        ---

        **API consumer:** <a href="/api-reference/authorization?tag=Authorization&amp;operationId=userLogin" target="_blank" rel="noopener">Synerise User</a>

        **User role permission required:** `managed_domains: create`
      operationId: verifyManagedDomainUsingPOST
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - domain
                - verificationMethod
              properties:
                domain:
                  type: string
                  description: Domain name
                  example: synerise.com
                verificationMethod:
                  type: string
                  enum:
                    - TXT_RECORD
                    - FILE_CHECK
                    - INTERNAL
                    - NONE
                  description: |
                    Verification method. The verification string can be retrieved by using [this method](#operation/initializeManagedDomainUsingPOST).

                    - TXT_RECORD: the verification string needs to be added to your DNS as a TXT record.
                    - FILE_CHECK: the site must include an HTML file whose name is the verification string. The file does not need any content.
                    - INTERNAL; NONE - currently not used
        required: true
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: number
                    format: int64
                    description: ID of the managed domain
                  domain:
                    type: string
                    description: Domain name
                    example: synerise.com
                  created:
                    type: string
                    format: date-time
                    description: Creation time
                  verificationMethod:
                    type: string
                    enum:
                      - TXT_RECORD
                      - FILE_CHECK
                      - INTERNAL
                      - NONE
                    description: |
                      Verification method. The verification string can be retrieved by using [this method](#operation/initializeManagedDomainUsingPOST).

                      - TXT_RECORD: the verification string needs to be added to your DNS as a TXT record.
                      - FILE_CHECK: the site must include an HTML file whose name is the verification string. The file does not need any content.
                      - INTERNAL; NONE - currently not used
                  verificationStatus:
                    type: string
                    description: Verification status
                    enum:
                      - VERIFIED
                      - NOT_VERIFIED
                  updated:
                    type: string
                    format: date-time
                    description: Time of last update
                  managedByProfile:
                    type: integer
                    description: ID of the workspace
                  usersCount:
                    type: number
                    format: int64
                    description: Number of users who belong to the domain
        "201":
          description: Created
          content: {}
        "401":
          description: Unauthorized
          content: {}
        "403":
          description: Forbidden
          content: {}
        "404":
          description: Not Found
          content: {}
      x-snr-doc-urls:
        - /api-reference/identity-and-access-management#tag/Directory/operation/verifyManagedDomainUsingPOST
      x-codeSamples:
        - lang: cURL
          label: cURL
          source: |-
            curl --request POST \
              --url https://api.synerise.com/uauth/managed-domains/verification \
              --header 'content-type: application/json' \
              --data '{"domain":"synerise.com","verificationMethod":"TXT_RECORD"}'
        - lang: Python
          label: Python
          source: |-
            import http.client

            conn = http.client.HTTPSConnection("api.synerise.com")

            payload = "{\"domain\":\"synerise.com\",\"verificationMethod\":\"TXT_RECORD\"}"

            headers = { 'content-type': "application/json" }

            conn.request("POST", "/uauth/managed-domains/verification", payload, headers)

            res = conn.getresponse()
            data = res.read()

            print(data.decode("utf-8"))
        - lang: JavaScript
          label: JavaScript
          source: |-
            const data = JSON.stringify({
              "domain": "synerise.com",
              "verificationMethod": "TXT_RECORD"
            });

            const xhr = new XMLHttpRequest();
            xhr.withCredentials = true;

            xhr.addEventListener("readystatechange", function () {
              if (this.readyState === this.DONE) {
                console.log(this.responseText);
              }
            });

            xhr.open("POST", "https://api.synerise.com/uauth/managed-domains/verification");
            xhr.setRequestHeader("content-type", "application/json");

            xhr.send(data);
        - lang: Node.js
          label: Node.js
          source: |-
            const http = require("https");

            const options = {
              "method": "POST",
              "hostname": "api.synerise.com",
              "port": null,
              "path": "/uauth/managed-domains/verification",
              "headers": {
                "content-type": "application/json"
              }
            };

            const req = http.request(options, function (res) {
              const chunks = [];

              res.on("data", function (chunk) {
                chunks.push(chunk);
              });

              res.on("end", function () {
                const body = Buffer.concat(chunks);
                console.log(body.toString());
              });
            });

            req.write(JSON.stringify({domain: 'synerise.com', verificationMethod: 'TXT_RECORD'}));
            req.end();
        - lang: PHP
          label: PHP
          source: |-
            <?php

            $request = new HttpRequest();
            $request->setUrl('https://api.synerise.com/uauth/managed-domains/verification');
            $request->setMethod(HTTP_METH_POST);

            $request->setHeaders([
              'content-type' => 'application/json'
            ]);

            $request->setBody('{"domain":"synerise.com","verificationMethod":"TXT_RECORD"}');

            try {
              $response = $request->send();

              echo $response->getBody();
            } catch (HttpException $ex) {
              echo $ex;
            }
        - lang: Java
          label: Java
          source: |-
            HttpResponse<String> response = Unirest.post("https://api.synerise.com/uauth/managed-domains/verification")
              .header("content-type", "application/json")
              .body("{\"domain\":\"synerise.com\",\"verificationMethod\":\"TXT_RECORD\"}")
              .asString();
servers:
  - description: Microsoft Azure EU
    url: https://api.synerise.com
  - description: Microsoft Azure USA
    url: https://api.azu.synerise.com
  - description: Google Cloud Platform
    url: https://api.geb.synerise.com
tags:
  - name: Directory
```
