Endpoint URL: {identityDomain} /config/{appId} /clients
Description
Creates a new API client.
To create a new API client, you must specify the client properties in the request body of your API call. Those client properties include:
- name. The name is the only required property, and the name you give the new client must be unique across the application. If you already have a client named Test Client, your API call will fail if you try to create another client with the name Test Client.
- ipWhitelist. JSON array of Classless Inter-Domain Routing IP addresses; only the addresses included on the whitelist will be able to interact with the new client. If you do not include the ipWhitelist property then the value will automatically be set to 0.0.0.0/0, which allows any IP address to interact with the client.
- features. Specifies the client feature (or features) associated with the new API client. Available features include:
- access_issuer. Issues access tokens scoped for use with all API clients.
- direct_access. Has read/write access to all user records.
- direct_read_access. Has read-only access to all user records.
- login_client. Has read/write access to the user record for the current user. This client is typically used for login and registration. API clients that have the login_client feature cannot be associated with any other feature (i.e., a client cannot have the login_client feature and, say, the direct_access feature).
- metadata. API calls made with this feature do not modify the lastUpdated attribute when making changes to a user profile; for example, your API call might update the user's displayName or familyName but will not change the lastUpdated attribute. This feature can only be assigned by Akamai: if you try assigning the metadata feature in your API call, that call will fail.
- owner. Has full administrative access to the application.
You do not have to assign a feature set when you create a new client. However, that client will not have permission to do anything until it has been assigned a feature set.
Both the ipWhitelist and features properties must be passed as JSON arrays. In a JSON array, individual values are enclosed in double quote marks and separated by using commas. In addition, the entire set of values is surrounded by square brackets:
["access_issuer", "direct_access"]
Your API call must have the owner permission in order to create a new client.
Respects the API Client Allow List: Yes
API Client Permissions
The following table indicates the API clients that can (and the API clients that can't) be used to call this endpoint:
owner | access_issuer | direct_access | direct_read_access | login_client |
Yes | No | No | No | No |
Authentication
This endpoint supports Basic authentication.
How to Create an Authentication String
Base URL
The base URL for this endpoint is your Configuration API domain followed by /config/ followed by your application ID. For example, if you are in the US region and your application ID is htb8fuhxnf8e38jrzub3c7pfrr, then your base URL would be:
https://v1.api.us.janrain.com/config/htb8fuhxnf8e38jrzub3c7pfrr
Allowed regions are:
- us
- eu
- au
- sa
- cn
- sg
Sample Request URL
In the following URL, replace htb8fuhxnf8e38jrzub3c7pfrr with your application ID:
https://v1.api.us.janrain.com/config/htb8fuhxnf8e38jrzub3c7pfrr/clients
Sample Request (curl)
This command creates a new API client named Documentation Client. The client can be accessed from any IP address (by setting the ipWhitelist to 0.0.0.0/0), and is assigned the login_client feature.
curl -X POST \ https://v1.api.us.janrain.com/config/htb8fuhxnf8e38jrzub3c7pfrr/clients \ -H 'Authorization: Basic
c2dueXZ1czZwYzRqbTdraHIybmVxNWdzODlnYnIyZXE6d3Q0YzN1bjl3a2tjZnZ5a25xeDQ0eW5jNDc2YWZzNjg' \ -H 'Content-Type: application/json' \ -d '{ "name": "Documentation Client", "ipWhitelist": ["0.0.0.0/0"], "features": ["login_client"] }'
Running this command in Postman
Responses
201 Created
If your API call succeeds, you'll see the response code 201 Created as well as property values for the new API client:
{
"_self": "/config/73jzx34tnr5ruhsze494ssgz2b/clients/3bchk5hsx6v58dkn288nbybmxfyk32u7",
"name": "Documentation Client",
"_settings": "/config/73jzx34tnr5ruhsze494ssgz2b/clients/3bchk5hsx6v58dkn288nbybmxfyk32u7/settings",
"ipWhitelist": [
"0.0.0.0/0"
],
"_secret": "55324vxdz3n35hjui77hh2qpoe6dbgs",
"_id": "3bchk5hsx6v58dkn288nbybmxfyk32u7",
"features": [
"login_client"
]
}
Error Codes
The following table includes information about some of the error codes that you could encounter when calling this endpoint.
Error Code | Description |
---|---|
400 | Error Message: The metadata feature can only be applied to a client by Akamai. Remove "metadata" from the list of client features and try the API call again. |
400 | Error Message: Clients with the login_client feature cannot have any other features. Remove all the features except login_client from the API call and try again. |
400 | Error Message: Missing data for required field. Typically, this means that you forgot to specify the client name. |
400 | Error Message: Not a valid string. Typically, this means that you did not provide a properly-formatted name. |
409 | Error Message: API client <name supplied> already exists. Client names must be unique within an application. |
400 | Error Message: Not a valid CIDR address. One or more of the IP addresses on the IP whitelist has been incorrectly formatted. |
400 | Error Message: Not a valid feature name. |
401/403 | Error Message: Authentication required. You either failed to provide credentials or you provided invalid credentials. This endpoint requires Basic authentication. |
404 | Error Message: Application ID not found. You did not provide a valid client application ID. |
If you encounter an error when calling this endpoint that error message will look similar to this:
{
"errors": "Authentication required."
}