---
title: "Create a new agent"
method: POST
path: "/v1.0/agent/profile/add"
tags: ["Agent User"]
---

# Create a new agent

`POST /v1.0/agent/profile/add`

Creates a new agent under the caller's team using the supplied profile.

Notes:
- accountInfo.phoneNumber and accountInfo.emailAddress are required.
- When phoneCode is omitted, '1' (US) is used by default.
- When roleName is supplied, it is resolved to the team's matching role; unknown names are ignored and the agent is created without a role binding.
- Long text fields (address, licenseId, position, personalWebsite, personalIntroduction, social-media item values) are silently truncated to their individual limits.
- The response envelope carries errorCode = 0 on success; non-zero values indicate validation failure or upstream error, with errorMsg describing the cause.

## Headers

- `Authorization` string, required
- `Content-Type` string, required

## Request body

- AgentProfile — Agent profile payload.
  - `accountType` integer, required — The account type of the agent
  - `accountInfo` AccountInfo, required — Account Base Info of agent, like name , email or phone and something else
    - `headUrl` string — The head url of the agent
    - `lastName` string, required — last name of the agent
    - `firstName` string, required — first name of the agent
    - `emailAddress` string, required — email address of the agent
    - `phoneNumber` string — phone number of the agent
    - `phoneCode` string — phone code of the agent
    - `phoneCountry` string — phone country of the agent
    - `tagIds` integer[] — tags of the agent
    - `sendingEmail` string
    - `domain` string
    - `allowChangeDomain` boolean
    - `roleName` string — roleName
    - `groupId` integer
    - `roleId` integer
    - `seatTypeName` string — the seat type code of the agent
  - `workInfo` WorkInfo — Work Info of agent, include company info etc..
    - `streetAddress` string — Street Address
    - `city` string — City
    - `country` string — Country
    - `state` string — State
    - `zipcode` string — Zipcode
    - `licenseId` string — licenseId of the agent
    - `companyName` string — Company Name
    - `companyAddress` string — Company Address
    - `position` string — position
    - `personalWebsite` string — Personal Website
    - `personalAttachments` FileInfo[]
      - `fileName` string
      - `size` integer
      - `queryLink` string
      - `contentType` string
    - `personalDisclaimers` FileInfo[]
      - `fileName` string
      - `size` integer
      - `queryLink` string
      - `contentType` string
    - `personalIntroduction` string — Personal Introduction
  - `socialMedias` SocialMedias — Social media of agent, include company info
    - `items` Item[]
      - `type` string
      - `name` string
      - `value` string
  - `personalPhotos` PersonalPhotos — Personal photos of agent
    - `urls` string[]
  - `hasBackOffice` boolean
  - `agentPid` string
  - `fullSync` boolean
  - `shouldSync` boolean
  - `checkRosterNum` boolean

## Response `200`

Envelope with the new agent's user ID, or a non-zero errorCode on failure.

- AddAgentResponse — Response for POST /v1.0/agent/profile/add. Envelope that carries the new agent's user ID and an error code when creation fails.
  - `data` integer — User ID of the newly created agent. Zero when creation fails or an existing agent is returned without a new ID.
  - `errorCode` integer — Business error code. 0 indicates success.
  - `errorMsg` string — Human-readable error message when errorCode != 0.

## Other responses

- `401` — Missing or invalid authentication token.
- `500` — Internal server error.

---

[API](https://skmtc.net/lofty/apis/lofty-service-open-apis.md) · [All operations](https://skmtc.net/lofty/apis/lofty-service-open-apis/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/lofty/lofty-service-open-apis/revisions/23e640467118/schema)
