> [!NOTE]
> **Note:** Requires [authorization](https://developers.google.com/android/work/play/emm-api/v1/enrollmenttokens/create#auth).

Creates an enrollment token for the enterprise.
This method is part of the EnrollmentTokensService.

## Request

### HTTP request

```
POST https://www.googleapis.com/androidenterprise/v1/enterprises/enterpriseId/enrollmentTokens
```

### Parameters

| Parameter name | Value | Description |
|---|---|---|
| **Path parameters** |||
| `enterpriseId` | `string` | The ID of the enterprise. |

### Authorization

This request requires authorization with the following scope:

| Scope |
|---|
| `https://www.googleapis.com/auth/androidenterprise` |

For more information, see the [authentication and authorization](https://developers.google.com/android/work/play/emm-api/v1/how-tos/authorizing) page.

### Request body

In the request body, supply data with the following structure:

```
{
  "kind": "androidenterprise#enrollmentToken",
  "token": string,
  "enrollmentTokenType": string,
  "duration": {
    "seconds": long,
    "nanos": integer
  },
  "googleAuthenticationOptions": {
    "authenticationRequirement": string,
    "requiredAccountEmail": string
  }
}
```

| Property name | Value | Description | Notes |
|---|---|---|---|
| `kind` | `string` |   |   |
| `token` | `string` | The token value that's passed to the device and authorizes the device to enroll. This is a read-only field generated by the server. |   |
| `enrollmentTokenType` | `string` | \[Required\] The type of the enrollment token. <br /> Acceptable values are: - "`enrollmentTokenTypeUnspecified`" - "`userDevice`" - "`userlessDevice`" |   |
| `duration` | `nested object` | \[Optional\] The length of time the enrollment token is valid, ranging from 1 minute to [Durations.MAX_VALUE](https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/util/Durations.html#MAX_VALUE), approximately 10,000 years. If not specified, the default duration is 1 hour. In the JSON REST API, this is represented as a string (e.g., \`3600s\`). |   |
| `duration.seconds` | `long` | Signed seconds of the span of time. |   |
| `googleAuthenticationOptions` | `nested object` | \[Optional\] Provides options related to Google authentication during the enrollment. |   |
| `googleAuthenticationOptions.authenticationRequirement` | `string` | \[Optional\] Specifies whether user should authenticate with Google during enrollment. If provided, overrides the `GoogleAuthenticationSettings` for the [enterprise resource](https://developers.google.com/android/work/play/emm-api/v1/enterprises) when devices are enrolled with this token. <br /> Acceptable values are: - "`authenticationRequirementUnspecified`" - "`optional`" - "`required`" |   |
| `googleAuthenticationOptions.requiredAccountEmail` | `string` | \[Optional\] Specifies the managed Google Account that the user must use during enrollment. `AuthenticationRequirement` must be set to `REQUIRED` if this field is set. |   |

## Response

If successful, this method returns a response body with the following structure:

```
{
  "kind": "androidenterprise#enrollmentToken",
  "token": string,
  "enrollmentTokenType": string,
  "duration": {
    "seconds": long,
    "nanos": integer
  },
  "googleAuthenticationOptions": {
    "authenticationRequirement": string,
    "requiredAccountEmail": string
  }
}
```

| Property name | Value | Description | Notes |
|---|---|---|---|
| `kind` | `string` |   |   |
| `token` | `string` | The token value that's passed to the device and authorizes the device to enroll. This is a read-only field generated by the server. |   |
| `enrollmentTokenType` | `string` | \[Required\] The type of the enrollment token. <br /> Acceptable values are: - "`enrollmentTokenTypeUnspecified`" - "`userDevice`" - "`userlessDevice`" |   |
| `duration` | `nested object` | \[Optional\] The length of time the enrollment token is valid, ranging from 1 minute to [Durations.MAX_VALUE](https://developers.google.com/protocol-buffers/docs/reference/java/com/google/protobuf/util/Durations.html#MAX_VALUE), approximately 10,000 years. If not specified, the default duration is 1 hour. In the JSON REST API, this is represented as a string (e.g., \`3600s\`). |   |
| `duration.seconds` | `long` | Signed seconds of the span of time. |   |
| `googleAuthenticationOptions` | `nested object` | \[Optional\] Provides options related to Google authentication during the enrollment. |   |
| `googleAuthenticationOptions.authenticationRequirement` | `string` | \[Optional\] Specifies whether user should authenticate with Google during enrollment. This setting, if specified, `GoogleAuthenticationSettings` specified for the enterprise resource is ignored for devices enrolled with this token. <br /> Acceptable values are: - "`authenticationRequirementUnspecified`" - "`optional`" - "`required`" |   |
| `googleAuthenticationOptions.requiredAccountEmail` | `string` | \[Optional\] Specifies the managed Google Account that the user must use during enrollment.`AuthenticationRequirement` must be set to`` REQUIRED` if this field is set.` `` |   |