---
title: "Create a new Active Directory Agent"
method: POST
path: "/api/v2/activedirectories/{activedirectory_id}/agents"
tags: ["Active Directory"]
---

# Create a new Active Directory Agent

`POST /api/v2/activedirectories/{activedirectory_id}/agents`

## Request

- Base URL: `https://console.jumpcloud.com`
- URL: `https://console.jumpcloud.com/api/v2/activedirectories/{activedirectory_id}/agents`
- Auth: API key in header `x-api-key`
- TypeScript: <https://skmtc.dev/jumpcloud/apis/jumpcloud-console-api/docs/api/v2/activedirectories/:activedirectory_id/agents/post.ts> (a function with typed inputs; its response is checked against the schema)

This endpoint allows you to create a new Active Directory Agent.


#### Sample Request
```
curl -X POST https://console.jumpcloud.com/api/v2/activedirectories/{activedirectory_id}/agents \
  -H 'accept: application/json' \
  -H 'content-type: application/json' \
  -H 'x-api-key: {API_KEY}' \
  -d '{ "agent_type":"{SYNC}" }'
```

## Headers

- `x-org-id` string

## Request body

- ActiveDirectoryAgent
  - `agentType` 'SYNC' | 'IMPORT'

## Response `201`

- ActiveDirectoryAgentGet
  - `connectKey` string: The connect key to use when installing the Agent on a Domain Controller.
  - `contactAt` string, nullable
  - `hostname` string, nullable
  - `hostType` string, nullable: Host role reported by the agent (DOMAIN_CONTROLLER or MEMBER_SERVER).
  - `id` string, required: ObjectID of this Active Directory Agent.
  - `passwordUpdatedAt` string, date-time, nullable
  - `source_ip` string, nullable
  - `state` 'unsealed' | 'active' | 'inactive'
  - `version` string, nullable

---

[API](https://skmtc.dev/jumpcloud/apis/jumpcloud-console-api.md) - [All operations](https://skmtc.dev/jumpcloud/apis/jumpcloud-console-api/llms.txt) - [OpenAPI document](https://skmtc.dev/jumpcloud/apis/jumpcloud-console-api/revisions/f396d9271b46?raw)
