# Register Domain — OpenSRS

> Register a new domain. See the documentation.

- Key: `opensrs-register-domain`
- Type: Action (Write)
- Version: 0.0.2
- App: OpenSRS (`opensrs`) — https://pipedream.com/apps/opensrs.md
- This page (HTML): https://pipedream.com/apps/opensrs/actions/register-domain
- Hints: open-world
- Source: https://github.com/PipedreamHQ/pipedream/blob/master/components/opensrs/actions/register-domain/register-domain.mjs

## Description

Register a new domain. [See the documentation](https://domains.opensrs.guide/docs/sw_register-domain-or-trust_service-).

## Props

| Prop | Type | Required | Description |
|---|---|---|---|
| `domain` | `string` | Yes | The domain name to register, update, or transfer. |
| `regUsername` | `string` | Yes | Usernames must be 3-20 characters in length. You can use any of the following alphanumeric characters: A-Z, a-z, 0-9. |
| `regPassword` | `string` | Yes | Passwords must be 10-20 characters in length. You can use any of the following alphanumeric characters and symbols: A-Z, a-z, 0-9, ! @$^,.~\|=-+_{}#. |
| `ownerFirstName` | `string` | Yes | The first name of the owner of the domain. |
| `ownerLastName` | `string` | Yes | The last name of the owner of the domain. |
| `ownerEmail` | `string` | Yes | The email of the owner of the domain. |
| `ownerOrgName` | `string` | No | The organization name of the owner of the domain. |
| `ownerPhone` | `string` | Yes | The phone number of the owner of the domain. |
| `ownerAddress1` | `string` | Yes | The first line of the address of the owner of the domain. |
| `ownerCity` | `string` | Yes | The city of the owner of the domain. |
| `ownerCountry` | `string` | Yes | The country of the owner of the domain. |
| `ownerState` | `string` | Yes | The state of the owner of the domain. |
| `ownerPostalCode` | `string` | Yes | The postal code of the owner of the domain. |
| `adminFirstName` | `string` | Yes | The first name of the admin of the domain. |
| `adminLastName` | `string` | Yes | The last name of the admin of the domain. |
| `adminEmail` | `string` | Yes | The email of the admin of the domain. |
| `adminOrgName` | `string` | No | The organization name of the admin of the domain. |
| `adminPhone` | `string` | Yes | The phone number of the admin of the domain. |
| `adminAddress1` | `string` | Yes | The first line of the address of the admin of the domain. |
| `adminCity` | `string` | Yes | The city of the admin of the domain. |
| `adminCountry` | `string` | Yes | The country of the admin of the domain. |
| `adminState` | `string` | Yes | The state of the admin of the domain. |
| `adminPostalCode` | `string` | Yes | The postal code of the admin of the domain. |
| `billingFirstName` | `string` | Yes | The first name of the billing contact of the domain. |
| `billingLastName` | `string` | Yes | The last name of the billing contact of the domain. |
| `billingEmail` | `string` | Yes | The email of the billing contact of the domain. |
| `billingOrgName` | `string` | No | The organization name of the billing contact of the domain. |
| `billingPhone` | `string` | Yes | The phone number of the billing contact of the domain. |
| `billingAddress1` | `string` | Yes | The first line of the address of the billing contact of the domain. |
| `billingCity` | `string` | Yes | The city of the billing contact of the domain. |
| `billingCountry` | `string` | Yes | The country of the billing contact of the domain. |
| `billingState` | `string` | Yes | The state of the billing contact of the domain. |
| `billingPostalCode` | `string` | Yes | The postal code of the billing contact of the domain. |
| `techFirstName` | `string` | Yes | The first name of the tech contact of the domain. |
| `techLastName` | `string` | Yes | The last name of the tech contact of the domain. |
| `techEmail` | `string` | Yes | The email of the tech contact of the domain. |
| `techOrgName` | `string` | No | The organization name of the tech contact of the domain. |
| `techPhone` | `string` | Yes | The phone number of the tech contact of the domain. |
| `techAddress1` | `string` | Yes | The first line of the address of the tech contact of the domain. |
| `techCity` | `string` | Yes | The city of the tech contact of the domain. |
| `techCountry` | `string` | Yes | The country of the tech contact of the domain. |
| `techState` | `string` | Yes | The state of the tech contact of the domain. |
| `techPostalCode` | `string` | Yes | The postal code of the tech contact of the domain. |
| `customTechContact` | `string` | Yes | An indication of whether to use the RSP's tech contact info, or the tech contact info provided n the request. |
| `autoRenew` | `string` | No | Whether to automatically renew the domain. |
| `period` | `string` | Yes | The length of the registration period. Allowed values are 1-10, depending on the TLD, that is, not all registries allow for a 1-year registration. The default is 2, which is valid for all TLDs. |
| `customNameservers` | `string` | Yes | Custom nameservers for the domain. |
| `jsonOutput` | `boolean` | No | Whether to output the response in JSON format. |

## Run it

**MCP**

```ts
import { Client } from "@modelcontextprotocol/sdk/client/index.js"
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js"
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const accessToken = await pd.rawAccessToken

const transport = new StreamableHTTPClientTransport(
  new URL("https://remote.mcp.pipedream.net/v3"),
  {
    requestInit: {
      headers: {
        Authorization: `Bearer ${accessToken}`,
        "x-pd-project-id": process.env.PIPEDREAM_PROJECT_ID!,
        "x-pd-environment": "production",
        "x-pd-external-user-id": "{external_user_id}", // any stable ID for this user in your system
        "x-pd-app-slug": "opensrs",
      },
    },
  },
)

const mcp = new Client({ name: "my-agent", version: "1.0.0" })
await mcp.connect(transport)

const { tools } = await mcp.listTools()

// listTools() hands your model this tool's input schema, so it can
// fill the arguments itself:
const result = await mcp.callTool({
  name: "opensrs-register-domain",
  arguments: {
    domain: "Domain",
    regUsername: "Reseller Username",
  },
})
```

**TypeScript**

```ts
import { PipedreamClient } from "@pipedream/sdk"

const pd = new PipedreamClient({
  projectId: process.env.PIPEDREAM_PROJECT_ID!,
  clientId: process.env.PIPEDREAM_CLIENT_ID!,
  clientSecret: process.env.PIPEDREAM_CLIENT_SECRET!,
  projectEnvironment: "production",
})

const result = await pd.actions.run({
  id: "opensrs-register-domain",
  externalUserId: "{external_user_id}", // any stable ID for this user in your system
  configuredProps: {
    opensrs: { authProvisionId: "apn_xxxxxxx" },
    domain: "Domain",
    regUsername: "Reseller Username",
  },
})

console.log(result)
```

**cURL**

```bash
curl -X POST https://api.pipedream.com/v1/connect/{project_id}/actions/run \
  -H "Content-Type: application/json" \
  -H "X-PD-Environment: production" \
  -H "Authorization: Bearer {access_token}" \
  -d '{
    "external_user_id": "{external_user_id}",
    "id": "opensrs-register-domain",
    "configured_props": {
      "opensrs": { "authProvisionId": "apn_xxxxxxx" },
      "domain": "Domain",
      "regUsername": "Reseller Username"
    }
  }'
```

---

- App: https://pipedream.com/apps/opensrs.md · All apps: https://pipedream.com/apps
