Users .: Update

API Reference / v15

Update a User

This endpoint updates a user account. Include as few or as many user parameters as you wish to update.

See section “Custom user attributes” for more information on the custom_attributes key.

This endpoint can only be used with an unlimited permission token (granted via username and password).

Request Endpoint

PUT /v15/users

Authorization Required – User Token in Header

Authorization: token user="123897-99SCvr3kSe3TqqQid3DyPXfo2Kq98MyhF6CaNPqoDeMhJ18Uopq19uddcznu6R"

Request Body

{
  "user": {
    "email": "foobar@thelevelup.com",
    ...
  }
}

Request Parameters

Param Type Required Description
born_at String (Date) No The user’s birthday as an ISO 8601 date (YYYY-MM-DD).
custom_attributes Object No Arbitrary key-value data to associate with this user. Scoped by the API Key associated with the request’s access token. For more information about custom user attributes, see section “Custom user attributes”.
email String No The user’s email address.
first_name String No The user’s first name.
gender String No The user’s gender. Valid values are ‘female’, 'male’, 'custom’, 'prefer_not_to_answer’ and null.
last_name String No The user’s last name.
password String No The user’s new password.
phone String No The user’s new phone number.
custom_gender String No The user’s input when 'custom’ is selected as gender type.

cURL Example

curl -X PUT -H Accept:application/json -H Content-Type:application/json -H 'Authorization:token user="123897-99SCvr3kSe3TqqQid3DyPXfo2Kq98MyhF6CaNPqoDeMhJ18Uopq19uddcznu6R"' -d '{ "user": { "last_name": "Foo" } }' https://sandbox.thelevelup.com/v15/users

Example Response Body

HTTP/1.1 200 OK

{
    "user": {
        "app_id": 20,
        "born_at": null,
        "cause_id": null,
        "connected_to_facebook": false,
        "custom_attributes": {},
        "debit_card_only": false,
        "email": "testcreds+consumer@thelevelup.com",
        "first_name": "TestCreds",
        "gender": null,
        "id": 34646,
        "last_name": "Foo",
        "merchants_visited_count": 1,
        "orders_count": 4,
        "phone": null,
        "terms_accepted_at": null,
        "user_app_id": 35096,
        "global_credit_amount": 0,
        "total_savings_amount": 400
    }
}

Response Parameters

Parameters Type Description
app_id Integer The app used to generate the access token for the request
id Integer The user’s ID.
born_at String The user’s birthdate (if available)
cause_id Integer The ID of the cause the user is associated with
connected_to_facebook Boolean The state of the user’s connection to facebook
custom_attributes Object Arbitrary key-value data to associate with this user. Scoped by the API Key associated with the request’s access token. For more information about custom user attributes, see section “Custom user attributes”.
email String The user’s email address
first_name String The user’s first name
gender String The user’s gender
debit_card_only Boolean If the user’s account is limited to debit cards
global_credit_amount Integer The amount (in cents) of global credit in the user’s account
last_name String The user’s last name
merchants_visited_count Integer The number of merchants the user has visited
orders_count Integer The number of orders a user has made
phone String The phone number of the user (if available)
terms_accepted_at String The date the user accepted LevelUp’s terms
total_savings_amount Integer The total amount the user has saved on Levelup

Errors

The user token is invalid

HTTP/1.1 401 Unauthorized