---
title: "API: createAdhocAPIKeys"
slug: "api-createadhocapikey"
updated: 2022-09-13T17:24:18Z
published: 2022-09-13T17:24:18Z
canonical: "support.smarteru.com/api-createadhocapikey"
---

> ## Documentation Index
> Fetch the complete documentation index at: https://support.smarteru.com/llms.txt
> Use this file to discover all available pages before exploring further.

# API: createAdhocAPIKey

- Starting June 1, 2022, SmarterU will require all API calls to POST to HTTPS. Any POST to HTTP will result in the SU:01 error (i.e., No POST data detected.).
- If you are viewing the help in a language other than English, please change your language to English before copying and pasting any code. All API attributes and functions are in English.
- Tags are required unless specified.

This feature is not enabled by default. If you're interested in using this feature, contact our [Success Desk](mailto:success@neovation.com) to have it enabled.

## Description

The createAdhocAPIKey API method returns a temporary API key for a user.

The API key returned by the createAdhocAPIKey method will expire after 3 minutes.

## Who Has Access

[Administrators and owners](https://support.smarteru.com/v1/docs/user-profile-information#access-level) have access to the createAdhocAPIKey method.

## API Call XML Package

```markup
<SmarterU>
   <AccountAPI><![CDATA[]]></AccountAPI>
   <UserAPI><![CDATA[]]></UserAPI>
   <Method>createAdhocAPIKey</Method>
   <Parameters>
      <User>
         <Identifier>
            <ID><![CDATA[]]></ID>
               - OR -
            <Email><![CDATA[]]></Email>
               - OR -
            <EmployeeID><![CDATA[]]></EmployeeID>
         </Identifier>
      </User>
   </Parameters>
</SmarterU>
```

## User Tag Group

The User tag group is a container for the user you'd like to create an API key for.

```markup
<User>
   <Identifier>
      <ID><![CDATA[]]></ID>
         - OR -
      <Email><![CDATA[]]></Email>
         - OR -
      <EmployeeID><![CDATA[]]></EmployeeID>   
   </Identifier>
</User>
```

The User tag contains the following.

### Identifier

A container for the user that you'd like to create an API key for. The tag contains one of the following.

| Tag | Description |
| --- | --- |
| **ID** | The user's system-generated identifier. This tag is mutually exclusive with the Email and EmployeeID tags. This is the ID returned by the [listUsers](/v1/docs/api-listusers) method. |
| **Email** | The [user's email address](https://support.smarteru.com/docs/user-login-information#primary-email-required-if-employee-id-not-specified). This tag is mutually exclusive with the ID and EmployeeID tags |
| **EmployeeID** | The [user's employee ID](https://support.smarteru.com/docs/user-login-information#employee-id-required-if-primary-email-not-specified). This tag is mutually exclusive with the ID and Email tags. |

## API Response XML Package

The [API response XML package](/v1/docs/api-response-xml-package) will always include a Result, Info, and [Errors](/v1/docs/api-createadhocapikey#error-codes) tag.

```markup
<SmarterU>
   <Result></Result>
   <Info>
      <User>
         <APIKey><![CDATA[]]></APIKey>
      </User>
   </Info>

   <Errors>
      <Error>
         <ErrorID></ErrorID>
         <ErrorMessage></ErrorMessage>
      </Error>
   </Errors>
</SmarterU>
```

The User tag is a container for the API key returned by the createAdhocAPIKey method and contains the following.

### APIKey

The API key that was created for the user.

### Example API Response XML Package

Below is an example of an API response XML package.

```markup
<SmarterU>
   <Result></Result>
   <Info>
      <User>
         <APIKey><![CDATA[*ldf^dypgnvi*nq33gml$*6xsup2*wpa8x$if2q4]]></APIKey>
      </User>
   </Info>

   <Errors>
   </Errors>
</SmarterU>
```

## Error Codes

| Error Code | Message |
| --- | --- |
| CAAK:01 | The id provided is not valid. |
| CAAK:02 | The email address provided is not valid. |
| CAAK:03 | The employee ID provided is not valid. |
| CAAK:04 | The required permissions are not met to call the createAdhocAPIKey method. |
| CAAK:05 | The user requested does not exist. |
| CAAK:06 | This method cannot be accessed from your location. |
| CAAK:07 | The requested user cannot be retrieved via the API. |
