Edit an account user
Overview
Change a user's details or locations.
Use this when roles change.
You'll need the user_id and the changes.
The user is updated. Every call replaces the user's name, title, deactivation date and location list with what you send, so send the current values for anything you're not changing (get them from Get one account user).
Prerequisites
- An Account token. See Authentication.
- The user's id, from List users.
Base URL
| Environment | URL |
|---|---|
| Production | https://production-api.shoutaboutus.com |
| Development | https://development-api.shoutaboutus.com |
Endpoint
POST /api/v1/user/edit
Authentication
Account token
- The user must be at the same account as the user behind the token, and can't be you. Otherwise, or with any other token (for example a Partner token), the API returns
403. - Every id in
store_idsmust be a location inside your account; otherwise422. - Only an Owner or Admin User can edit users. You can't edit the Owner, or a user who ranks above you (Owner, then Admin User, then User, Brand Assigned and Location Assigned, then Basic User). Otherwise
403.
Rate limit
This endpoint has no rate limit.
Request parameters
None.
Request body
| Field | Type | Required | Notes |
|---|---|---|---|
user | integer | Yes | The id of the user to edit. |
first_name | string | Yes | Up to 255 characters. Can't contain < or >. |
last_name | string | No | Up to 255 characters. Can't contain < or >. Left out, it's cleared. |
title | string | No | Job title. Up to 50 characters. Can't contain < or >. Left out, it's cleared. |
password | string | No | A new password: 8 to 100 characters, with upper- and lower-case letters, a number and a symbol. No quotes, backslashes or spaces. Leave it out or empty to keep the current password. A new password signs the user out everywhere: their tokens are revoked, except the API key from the dashboard's API Keys page. |
user_type | string | Yes | The user's role: admin, location_assign (only the locations in store_ids) or basic. admin removes every location assignment. |
store_ids | array of integers | Yes, when user_type is location_assign, or basic with assign_all_accounts: 0 | The locations the user can access. Replaces the current list. Each must be inside your account. |
assign_all_accounts | integer | Yes, when user_type is basic | 1: all locations. 0: only the locations in store_ids. |
send_default_reports | integer | No | 0 or 1. Not used when editing; the user's report subscriptions don't change. |
inactive_at | string | No | Date and time to deactivate the user, as YYYY-MM-DD HH:MM:SS. Left out or null, any deactivation date is cleared. |
Request payload
{
"user": 12,
"first_name": "Jane",
"last_name": "Smith",
"title": "Manager",
"user_type": "location_assign",
"store_ids": [
3007
],
"inactive_at": null
}Response body
The payload is inside data.
| Field | Type | Description |
|---|---|---|
status | string | success. |
response | string | User information has been updated successfully |
Response payload
{
"data": {
"status": "success",
"response": "User information has been updated successfully"
}
}Examples
Success payload
See Response payload.
Error payload
403 Not allowed
The token isn't an Account token, the user isn't at your account, or the user is you.
{
"message": "This action is unauthorized."
}403 Not allowed to manage this user
You're not an Owner or Admin User, or the user is the Owner or ranks above you.
{
"message": "Forbidden",
"status": "error",
"errors": "You do not have permission to manage this user."
}422 Required fields missing
{
"message": "The user type field is required. (and 1 more error)",
"errors": {
"user_type": [
"The user type field is required."
],
"first_name": [
"The first name field is required."
]
}
}422 Location outside your account
{
"message": "The selected store_ids.0 does not belong to your company hierarchy.",
"errors": {
"store_ids.0": [
"The selected store_ids.0 does not belong to your company hierarchy."
]
}
}| Status | Meaning |
|---|---|
200 | The user was updated. |
401 | The token is missing, expired or invalid. |
403 | The token isn't an Account token, the user isn't at your account, the user is you, or you're not allowed to manage them (see Authentication). |
422 | A field is missing or invalid, or a location is outside your account. |
500 | Unexpected server error. Nothing was saved. |
Example request
curl --request POST \
--url "https://production-api.shoutaboutus.com/api/v1/user/edit" \
--header 'Authorization: Bearer <bearer-token>' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--data '{"user": 12, "first_name": "Jane", "last_name": "Smith", "title": "Manager", "user_type": "location_assign", "store_ids": [3007], "inactive_at": null}'Updated 14 days ago
Did this page help you?
