# Create a user

From **GitHub v3 REST API**.

`POST /admin/users`

If an external authentication mechanism is used, the login name should match the login name in the external system. If you are using LDAP authentication, you should also [update the LDAP mapping](https://docs.github.com/enterprise-server@3.0/rest/reference/enterprise-admin#update-ldap-mapping-for-a-user) for the user.

The login name will be normalized to only contain alphanumeric characters or single hyphens. For example, if you send `"octo_cat"` as the login, a user named `"octo-cat"` will be created.

If the login name or email address is already associated with an account, the server will return a `422` response.

## Request body

- Required: true
### `application/json`

- Type: `object`

```json
{
  "email": "octocat@github.com",
  "login": "monalisa"
}
```

```json
{"properties":{"email":{"description":"**Required for built-in authentication.** The user's email address. This parameter can be omitted when using CAS, LDAP, or SAML. For details on built-in and centrally-managed authentication, see the the [GitHub authentication guide](https://docs.github.com/enterprise/2.18/admin/guides/user-management/authenticating-users-for-your-github-enterprise-server-instance/).","type":"string"},"login":{"description":"The user's username.","type":"string"}},"required":["login"],"type":"object"}
```

## Responses

### `201`

Response

### `application/json`

- Type: `object`

Simple User

```json
{
  "avatar_url": "https://github.com/images/error/octocat_happy.gif",
  "events_url": "https://api.github.com/users/octocat/events{/privacy}",
  "followers_url": "https://api.github.com/users/octocat/followers",
  "following_url": "https://api.github.com/users/octocat/following{/other_user}",
  "gists_url": "https://api.github.com/users/octocat/gists{/gist_id}",
  "gravatar_id": "",
  "html_url": "https://github.com/octocat",
  "id": 1,
  "login": "octocat",
  "node_id": "MDQ6VXNlcjE=",
  "organizations_url": "https://api.github.com/users/octocat/orgs",
  "received_events_url": "https://api.github.com/users/octocat/received_events",
  "repos_url": "https://api.github.com/users/octocat/repos",
  "site_admin": false,
  "starred_url": "https://api.github.com/users/octocat/starred{/owner}{/repo}",
  "subscriptions_url": "https://api.github.com/users/octocat/subscriptions",
  "type": "User",
  "url": "https://api.github.com/users/octocat"
}
```

```json
{"description":"Simple User","properties":{"avatar_url":{"example":"https://github.com/images/error/octocat_happy.gif","format":"uri","type":"string"},"email":{"nullable":true,"type":"string"},"events_url":{"example":"https://api.github.com/users/octocat/events{/privacy}","type":"string"},"followers_url":{"example":"https://api.github.com/users/octocat/followers","format":"uri","type":"string"},"following_url":{"example":"https://api.github.com/users/octocat/following{/other_user}","type":"string"},"gists_url":{"example":"https://api.github.com/users/octocat/gists{/gist_id}","type":"string"},"gravatar_id":{"example":"41d064eb2195891e12d0413f63227ea7","nullable":true,"type":"string"},"html_url":{"example":"https://github.com/octocat","format":"uri","type":"string"},"id":{"example":1,"type":"integer"},"login":{"example":"octocat","type":"string"},"name":{"nullable":true,"type":"string"},"node_id":{"example":"MDQ6VXNlcjE=","type":"string"},"organizations_url":{"example":"https://api.github.com/users/octocat/orgs","format":"uri","type":"string"},"received_events_url":{"example":"https://api.github.com/users/octocat/received_events","format":"uri","type":"string"},"repos_url":{"example":"https://api.github.com/users/octocat/repos","format":"uri","type":"string"},"site_admin":{"type":"boolean"},"starred_at":{"example":"\"2020-07-09T00:17:55Z\"","type":"string"},"starred_url":{"example":"https://api.github.com/users/octocat/starred{/owner}{/repo}","type":"string"},"subscriptions_url":{"example":"https://api.github.com/users/octocat/subscriptions","format":"uri","type":"string"},"type":{"example":"User","type":"string"},"url":{"example":"https://api.github.com/users/octocat","format":"uri","type":"string"}},"required":["avatar_url","events_url","followers_url","following_url","gists_url","gravatar_id","html_url","id","node_id","login","organizations_url","received_events_url","repos_url","site_admin","starred_url","subscriptions_url","type","url"],"title":"Simple User","type":"object"}
```

## Request examples

### cURL

```shell
curl --request POST \
  --url {protocol}://{hostname}/api/v3/admin/users \
  --header 'content-type: application/json' \
  --data '{
  "email": "octocat@github.com",
  "login": "monalisa"
}'
```
