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

Base URL

EnvironmentURL
Productionhttps://production-api.shoutaboutus.com
Developmenthttps://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_ids must be a location inside your account; otherwise 422.
  • 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

FieldTypeRequiredNotes
userintegerYesThe id of the user to edit.
first_namestringYesUp to 255 characters. Can't contain < or >.
last_namestringNoUp to 255 characters. Can't contain < or >. Left out, it's cleared.
titlestringNoJob title. Up to 50 characters. Can't contain < or >. Left out, it's cleared.
passwordstringNoA 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_typestringYesThe user's role: admin, location_assign (only the locations in store_ids) or basic. admin removes every location assignment.
store_idsarray of integersYes, when user_type is location_assign, or basic with assign_all_accounts: 0The locations the user can access. Replaces the current list. Each must be inside your account.
assign_all_accountsintegerYes, when user_type is basic1: all locations. 0: only the locations in store_ids.
send_default_reportsintegerNo0 or 1. Not used when editing; the user's report subscriptions don't change.
inactive_atstringNoDate 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.

FieldTypeDescription
statusstringsuccess.
responsestringUser 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."
    ]
  }
}
StatusMeaning
200The user was updated.
401The token is missing, expired or invalid.
403The 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).
422A field is missing or invalid, or a location is outside your account.
500Unexpected 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}'

Did this page help you?