Documentation Documentation

Admin API Users

In order to make it easier to create and manage users in Tyk Dashboard, there is an Admin API version of the Users API that is not Organisation specific.

In a production environment, you need to change the default admin_Secret value that is called by the admin-auth header in yourtyk_analytics.conf file. This is located in /opt/tyk-dashboard.

Get User

Property Description
Resource URL /admin/users/{user-id}}
Method GET
Type None
Body None
Param None

Sample Request

GET /admin/users/54bd0ad9ff4329b88985aafb HTTP/1.1
Host: localhost:3000
admin-auth: 12345

Sample Response

{
  "api_model": {},
  "first_name": "Test",
  "last_name": "User",
  "email_address": "[email protected]",
  "password": "",
  "org_id": "54b53d3aeba6db5c35000002",
  "active": true,
  "id": "54bd0ad9ff4329b88985aafb",
  "access_key": "f81ee6f0c8f2467d539c132c8a422346"
}

Add user

When you add a new user, they are created without a password being set. After adding a user, you need to use the Set Password call to set a password using the user-id created.

Property Description
Resource URL /admin/users
Method POST
Type None
Body User Object
Param None

Sample Request

POST /admin/users HTTP/1.1
Host: localhost:3000
admin-auth: 12345

{
  "first_name": "Jason",
  "last_name": "Jasonson",
  "email_address": "[email protected]",
  "active": true,
  "user_permissions": { "IsAdmin": "admin" }
}

Sample Response

{
  "Status": "OK",
  "Message": "User created",
  "Meta": ""
}

Update User

You need to have the users Permission object set to write to use Update User.

Property Description
Resource URL /admin/users/{uid}
Method PUT
Type None
Body User Object
Param None

Sample Request

PUT /admin/users/54c25e845d932847067402e2 HTTP/1.1
Host: localhost:3000
admin-auth: 12345

{
  "first_name": "Jason",
  "last_name": "File",
  "email_address": "[email protected]",
  "active": true,
  "password": "plaintext_password",
  "user_permissions": { "IsAdmin": "admin" }
}

Sample Response

{
  "Status": "OK",
  "Message": "User created",
  "Meta": ""
}