# Create Validator

`POST /networks/:networkId/validators`

Create a new Canton Validator.

{% hint style="info" %}

* Request headers required. See [Request Headers](https://github.com/dfns/dfns-api-docs/blob/m/api-docs/getting-started/request-headers.md) for more information.
* Authentication required. See [Authentication Headers](https://github.com/dfns/dfns-api-docs/blob/m/api-docs/getting-started/request-headers.md#authentication-headers) for more information.
  {% endhint %}

## Required Permissions

| Name                               | Conditions      |
| ---------------------------------- | --------------- |
| `Networks:CantonValidators:Create` | Always Required |

## Request body <a href="#request-body" id="request-body"></a>

### Sample request body for Shared <a href="#sample-request" id="sample-request"></a>

```json
{
  "kind": "Shared",
  "name": "My shared validator"
}
```

### Sample request body for Custom <a href="#sample-request" id="sample-request"></a>

#### Auth0

```json
{
  "kind": "Custom",
  "name": "My custom validator with Auth0",
  "validator": {
    "url": "https://validator.testnet.mydomain.com/",
    "oauth2": {
      "domain": "https://<xxxxxx>.us.auth0.com",
      "clientId": "xxxxxx",
      "clientSecret": "xxxxxxx",
      "audience": "https://canton.network.global",
    }
  },
  "ledger": {
    "url": "https://validator.testnet.mydomain.com/",
    "oauth2": {
      "domain": "https://<xxxxxx>.us.auth0.com",
      "tokenPath": "xxxxxx/xxxxx",
      "clientId": "xxxxx",
      "clientSecret": "xxxxxxx",
      "audience": "https://canton.network.global"
    }
  }
}
```

#### Okta

```json
{
  "kind": "Custom",
  "name": "My custom validator with Okta",
  "validator": {
    "url": "https://validator.testnet.mydomain.com/",
    "oauth2": {
      "domain": "https://<xxxxxx>.okta.com",
      "tokenPath": "oauth2/<xxxxxx>/v1/token",
      "clientId": "xxxxxx",
      "clientSecret": "xxxxxxx",
      "audience": "https://validator.testnet.mydomain.com/",
    }
  },
  "ledger": {
    "url": "https://validator.testnet.mydomain.com/",
    "oauth2": {
      "domain": "https://<xxxxxx>.okta.com",
      "tokenPath": "oauth2/<xxxxxx>/v1/token",
      "clientId": "xxxxx",
      "clientSecret": "xxxxxxx",
      "audience": "https://validator.testnet.mydomain.com/"
    }
  }
}
```

#### Keycloak

```json
{
  "kind": "Custom",
  "name": "My custom validator with Keycloak",
  "validator": {
    "url": "https://validator.testnet.mydomain.com/",
    "oauth2": {
      "domain": "https://my-own-server.running-keycloak.com",
      "tokenPath": "/auth/realms/<xxxxx>/protocol/openid-connect/token",
      "clientId": "xxxxxx",
      "clientSecret": "xxxxxxx",
      "audience": "https://validator.testnet.mydomain.com/"
    }
  },
  "ledger": {
    "url": "https://validator.testnet.mydomain.com/",
    "oauth2": {
      "domain": "https://my-own-server.running-keycloak.com",
      "tokenPath": "/auth/realms/<xxxxx>/protocol/openid-connect/token",
      "clientId": "xxxxx",
      "clientSecret": "xxxxxxx",
      "audience": "https://validator.testnet.mydomain.com/"
    }
  }
}
```

## Response <a href="#response" id="response"></a>

### Response example <a href="#response-example" id="response-example"></a>

```json
{
  "id": "cv-xxxx",
  "kind": "Custom",
  "name": "My custom validator",
  "dateCreated": "2023-04-14T20:41:28.715Z"
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs-legacy.dfns.co/d/api-docs/networks/validators/create-validator.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
