Search…
Users
Where your customers CRUD is kept.

User Object

The User Object holds all the usual info you'd expect, name, phone number, address, etc. You can also add tags to users, which can be used to search, and come in handy when you get into our ML tools.
Attributes
Type
Description
first_name
string
First name of the user.
last_name
string
Last name of the user.
salutation
string
Title of the user.
email
string
E-mail of the user.
mobile_phone_number
string
Phone number of the user.
addresses
array
An array of Addresses associated with the user.
billing_address
object
Billing Address of the user.
default_payment_method
string
Default payment method of the user.
last_login
string
Date when user last logged in. Timestampformat.
bio
string
Biographical note about the user.
tags
array
List of tags associated with user.
note
string
Additional notes regarding the user.
human_id
string
Human readable ID that identifies the order easily, e.g. 3AG7UA.
image
object
Image object for this user.

User Role

Changes since API version 2019-02-01

2020-02-13 - Create a User - New route

    The route/v2/usersis now deprecated: to create a user you must use/users.

Create a User*

And on the 6th day, you can make pancakes and watch cartoons, cuz creating new users is super easy. Just use POST /users.
We use the JWT in the header to identify a User. According to the JWT specs, the subclaim is the identifier of the subject, i.e. the user. So, whenever you send us a JWT, we extract the subvalue and use that as the user ID.
See Authentication for how to get a JWT. With the route POST /users, you could both create a new user with a JWT and login a user with their JWT.
Parameters
HTTP
Core SDK
Body Parameters
Type
Description
first_name
string
First name of the user.
last_name
string
Last name of the user.
salutation
string
Title of the user.
email
string
E-mail of the user.
mobile_phone_number
string
Phone number of the user.
addresses
array
An array of Addresses associated with the user.
billing_address
object
Billing Address of the user.
bio
string
Biographical note about the user.
tags
array
List of tags associated with the user.
note
string
Additional notes regarding the user.
image
string
An Image ID
Request --
1
POST /users HTTP/1.1
2
Content-Type: application/json
3
Authorization: Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOi
4
IxMjM0NTY3ODkwIiwibGFzdF9uYW1lIjoiRG9lIiwiZmlyc3RfbmFtZSI6IkpvaG4iLCJ
5
pYXQiOjE1MTYyMzkwMjJ9.YEqWlNmcheENbeSTjXhA-LMfULwa7t_Ab71tDmLGUxA
6
X-Builton-Api-Key: <builton-api-key>
7
Host: api.builton.dev
8
9
{
10
"first_name": "Jone",
11
"last_name": "Doe",
12
"email": "[email protected]"
13
}
Copied!
Response --
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
HTTP/1.1 200 OK
4
Content-Type: application/json
5
6
{
7
"_id": {"$oid": "5a25250cd57ba213edcba515"},
8
"first_name": "Jane",
9
"last_name": "Doe",
10
"email": "[email protected]",
11
[...]
12
}
Copied!
1
builton.users.create({
2
first_name: 'Jone',
3
last_name: 'Doe',
4
5
mobile_phone_number: '+4712345678',
6
}).then(console.log);
Copied!

Retrieve a User

Parameters
HTTP
Core SDK
Path Parameters
Type
Description
<user_id>
string
User ID
Request --
1
GET /users/me HTTP/1.1
2
Content-Type: application/json
3
Authorization: Bearer <jwt>
4
X-Builton-Api-Key: <builton-api-key>
5
Host: api.builton.dev
Copied!
Response --
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
4
{
5
"_id": {"$oid": "5a25250cd57ba213edcba515"},
6
"first_name": "Jane",
7
"last_name": "Doe",
8
"email": "[email protected]",
9
[...]
10
}
Copied!
1
builton.users.get('me').then(console.log);
2
// OR, if you already have a user stored in a variable:
3
builton.users.setMe().get().then(console.log);
4
5
/*
6
User {
7
id: '5a25250cd57ba213edcba515',
8
first_name: Jane,
9
last_name: Doe,
11
[...]
12
*/
Copied!
To retrieve, update, or delete your currently logged-in user, you can replace the user id in the query parameter with me.

Update a User

Parameters
HTTP
Core SDK
Path Parameter
Type
Description
<user_id>
string
User ID
Body Parameters
Type
Description
first_name
string
First name of the user.
last_name
string
Last name of the user.
salutation
string
Title of the user.
email
string
E-mail of the user.
mobile_phone_number
string
Phone number of the user.
default_payment_method
string
Default payment method of the user.
addresses
array
An arrayof Addressesassociated with the user.
billing_address
object
Address used for billing purposes.
bio
string
Biographical note about the user.
tags
array
List of tags associated with the user.
note
string
Additional notes regarding the user.
Request --
1
PUT /users/me HTTP/1.1
2
Content-Type: application/json
3
Authorization: Bearer <jwt>
4
X-Builton-Api-Key: <builton-api-key>
5
Host: api.builton.dev
6
7
{
8
"first_name": "Oliver"
9
}
Copied!
Response --
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
4
{
5
"_id":{"$oid":"57ee9c72d76d431f85111432"},
6
"first_name":"Oliver",
7
"last_name":"Doe",
8
[...]
9
}
Copied!
1
builton.users.setMe().update({
2
first_name: 'Oliver'
3
}).then(console.log);
4
5
/*
6
User {
7
id: '5a25250cd57ba213edcba515',
8
first_name: Oliver,
9
last_name: Doe,
11
[...]
12
*/
Copied!

Update a User's Addresses

Parameters
HTTP
Core SDK
Path Parameter
Type
Description
<user_id>
string
User ID
Body Parameters
Type
Description
addresses
array
An arrayof Addressesassociated with the user.
Request --
1
PUT /users/me/addresses HTTP/1.1
2
Content-Type: application/json
3
Authorization: Bearer <jwt>
4
X-Builton-Api-Key: <builton-api-key>
5
Host: api.builton.dev
6
7
{
8
"addresses": [
9
{
10
"city":"Oslo",
11
"service":"google",
12
"alias":"",
13
"country":"Norway",
14
"zip_code":"0182",
15
"street_name":"Hausmanns gate 29"
16
}
17
]
18
}
Copied!
Response --
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
4
{
5
"_id":{"$oid":"57ee9c72d76d431f85111432"},
6
"first_name":"Oliver",
7
"last_name":"Doe",
8
"addresses": [
9
{
10
"zip_code": "0182",
11
"alias": "",
12
"geo": [
13
59.91764119999999,
14
10.7540584
15
],
16
"street_name": "Hausmanns gate 29",
17
"service": "google",
18
"country": "Norway",
19
"raw": {
20
"plus_code": {
21
"compound_code": "WQ93+3J Oslo, Norway",
22
"global_code": "9FFGWQ93+3J"
23
},
24
"geometry": {
25
"location": {
26
"lat": 59.91764119999999,
27
"lng": 10.7540584
28
},
29
"location_type": "ROOFTOP",
30
"viewport": {
31
"northeast": {
32
"lat": 59.9189901802915,
33
"lng": 10.7554073802915
34
},
35
"southwest": {
36
"lat": 59.91629221970849,
37
"lng": 10.7527094197085
38
}
39
}
40
},
41
"types": [
42
"street_address"
43
],
44
"formatted_address": "Hausmanns gate 29, 0182 Oslo, Norway",
45
"place_id": "ChIJbbryrGZuQUYR812VHuiBKBQ"
46
},
47
"service_address_id": "ChIJbbryrGZuQUYR812VHuiBKBQ",
48
"city": "Oslo"
49
}
50
],
51
[...]
52
}
Copied!
1
builton.users.setMe().update({
2
addresses: [{
3
"street_name": "Nadderudåsen 30",
4
"city": "Bekkestua",
5
"zip_code": "1357",
6
"country": "Norway"
7
}]
8
});
Copied!

Delete a User

Parameters
HTTP
Core SDK
Path Parameter
Type
Description
<user_id>
string
User ID
Request --
1
DELETE /users/me HTTP/1.1
2
Content-Type: application/json
3
Authorization: Bearer <jwt>
4
X-Builton-Api-Key: <builton-api-key>
5
Host: api.builton.dev
Copied!
Response --
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
4
{
5
"_id":{"$oid":"57ee9c72d76d431f85111432"},
6
"created":{"$date":1475428903950},
7
"modified":{"$date":1475428903951},
8
[...]
9
"deleted":true
10
}
Copied!
1
builton.users.setMe().del().then(console.log);
2
3
/*
4
User {
5
id: '57ee9c72d76d431f85111432',
6
created: {'$date':1475428903950},
7
modified: {'$date':1475428903951},
8
[...]
9
deleted: true
10
}
11
*/
Copied!

List All Orders for a User

Parameters
HTTP
Core SDK
Path Parameter
Type
Description
<user_id>
string
User ID
Query Parameters
Type
Description
size
number
Number of items to retrieve.
page
number
Which page to retrieve. Default is 10.
sort
string
Field used for sorting results. Default is created.
from_date
number
Start date, timestamp format. Default is current date minus 15 days.
to_date
number
End date, timestamp format. Default is current date plus 15 days.
date_filter
string
Date field used to filter results. Default is created.
order_status
string
Orders with a specific status are also listed. Values can be separated by a comma, e.g., success, processing.
delivery_status
string
Orders with a specific delivery status are also listed. Values can be separated by a comma, e.g., assigned, done, created.
Request --
1
GET /users/me/orders HTTP/1.1
2
Content-Type: application/json
3
Authorization: Bearer <jwt>
4
X-Builton-Api-Key: <builton-api-key>
5
Host: api.builton.dev
Copied!
Response --
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
4
[
5
{
6
"_id": {
7
"$oid": "5c815f19ce39da0008e83eae"
8
},
9
"total_amount": 42,
10
"items": [...]
11
[...]
12
},
13
[...]
14
]
Copied!
1
builton.orders.get().then(page => {
2
console.log(page.current); // First page
3
});
4
5
/*
6
[
7
Order {
8
id: '5c815f19ce39da0008e83eae',
9
total_amount: 42,
10
items: [...]
11
[...]
12
},
13
[...]
14
]
15
*/
Copied!

List All Payment Methods for a User

Parameters
HTTP
Core SDK
Path Parameter
Type
Description
<user_id>
string
User ID
Query Parameters
Type
Description
size
number
Number of items to retrieve.
page
number
Which page to retrieve. Default is 10.
sort
string
Field used for sorting results. Default is created.
from_date
number
Start date, timestamp format. Default is current date minus 15 days.
to_date
number
End date, timestamp format. Default is current date plus 15 days.
date_filter
string
Date field used to filter results. Default is created.
Request --
1
GET /users/me/payment_methods HTTP/1.1
2
Content-Type: application/json
3
Authorization: Bearer <jwt>
4
X-Builton-Api-Key: <builton-api-key>
5
Host: api.builton.dev
Copied!
Response --
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
4
[
5
{
6
"_id":{"$oid":"57ee9c43d75d241d82231433"},
7
"active":true,
8
"user":{"$oid":"57ee9c72d76d431f85111432"},
9
"method":"stripe",
10
[...]
11
"card":{
12
[...]
13
}
14
}
15
]
Copied!
1
builton.paymentMethods.get().then(page => {
2
console.log(page.current); // First page
3
});
4
5
/*
6
[
7
paymentMethod {
8
id: '57ee9c43d75d241d82231433'
9
active: true,
10
user: {$oid: '57ee9c72d76d431f85111432'},
11
method: 'stripe',
12
[...]
13
card: {
14
[...]
15
}
16
}
17
]
18
*/
Copied!

List All Subscriptions for a User

Receives a list of all Subscriptions associated with the user.
Parameters
HTTP
Core SDK
Path Parameter
Type
Description
<user_id>
string
User ID
Query Parameters
Type
Description
include_deleted
boolean
If true, the request also returns all deleted subscriptions.
size
number
Number of subscriptions per page. Default is 10.
page
number
Which page to retrieve. Default is 0.
sort
string
Field used to sort results. Default is -modified.
status
string
The subscription status Default is ACTIVE.
Request --
1
GET /users/me/subscriptions HTTP/1.1
2
Content-Type: application/json
3
Authorization: Bearer <jwt>
4
X-Builton-Api-Key: <builton-api-key>
5
Host: api.builton.dev
Copied!
Response --
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
4
[
5
{
6
"_id": {
7
"$oid": "5b570317a5f4b4000b6618dc"
8
},
9
"plan": {
10
"$oid": "5b3b77dd1884cc00086ebbc7"
11
},
12
"method": "license",
13
"throttling_starts": 1000,
14
"name": "LICENSE",
15
"status": "CREATED",
16
"is_retrying_payment": false,
17
"infinite": false,
18
"total_fail_attempts": 0,
19
"payments": [],
20
"user": {
21
"$oid": "5b55ba2c89dff8000d0d5c29"
22
},
23
"trial": false,
24
[...]
25
},
26
{
27
"_id": {
28
"$oid": "5b570604a5f4b400086612da"
29
},
30
"plan": {
31
"$oid": "5b3b77dd1884cc00086ebbc7"
32
},
33
"method": "license",
34
"throttling_starts": 1000,
35
"name": "LICENSE",
36
"status": "CREATED",
37
"is_retrying_payment": false,
38
"infinite": false,
39
"total_fail_attempts": 0,
40
"payments": [],
41
"user": {
42
"$oid": "5b55ba2c89dff8000d0d5c29"
43
},
44
"trial": false,
45
[...]
46
}
47
]
Copied!
1
builton.subscriptions.get().then(page => {
2
console.log(page.current); // First page
3
});
4
5
/*
6
[
7
Subscription {
8
id: '5b570317a5f4b4000b6618dc',
9
plan: {
10
'$oid': '5b3b77dd1884cc00086ebbc7'
11
},
12
method: 'license',
13
throttling_starts: 1000,
14
name: 'LICENSE',
15
status: 'CREATED',
16
is_retrying_payment: false,
17
infinite: false,
18
total_fail_attempts: 0,
19
payments: [],
20
user: {
21
'$oid': '5b55ba2c89dff8000d0d5c29'
22
},
23
trial: false,
24
[...]
25
},
26
Subscription {
27
'_id': {
28
'$oid': '5b570604a5f4b400086612da'
29
},
30
'plan': {
31
'$oid': '5b3b77dd1884cc00086ebbc7'
32
},
33
'method': 'license',
34
'throttling_starts': 1000,
35
'name': 'LICENSE',
36
'status': 'CREATED',
37
'is_retrying_payment': false,
38
'infinite': false,
39
'total_fail_attempts': 0,
40
'payments': [],
41
'user': {
42
'$oid': '5b55ba2c89dff8000d0d5c29'
43
},
44
'trial': false,
45
[...]
46
}
47
]
48
*/
Copied!

Admin Role

*Paths listed above and denoted with a star are accessible to both Users and Admins. Additional Admin Role paths are listed below.

Retrieve a User

Parameters
HTTP
Node SDK
Python SDK
Path Parameter
Type
Description
<user_id>
string
User ID
Request --
1
GET /users/5a25250cd57ba213edcba515 HTTP/1.1
2
Content-Type: application/json
3
Authorization: Bearer <service-account-key>
4
X-Builton-Api-Key: <builton-api-key>
5
Host: api.builton.dev
Copied!
Response --
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
4
{
5
"_id": {"$oid": "5a25250cd57ba213edcba515"},
6
"first_name": "Jane",
7
"last_name": "Doe",
8
"email": "[email protected]",
9
[...]
10
}
Copied!
1
builton.users.get('5a25250cd57ba213edcba515').then(console.log);
2
3
/*
4
User {
5
id: '5a25250cd57ba213edcba515',
6
first_name: Jane,
7
last_name: Doe,
9
[...]
10
}
11
*/
Copied!
1
user = builton.user().get('5a25250cd57ba213edcba515')
2
print(user)
3
4
# <User 5a25250cd57ba213edcba515>
Copied!

Retrieve All Users

Parameters
HTTP
Node SDK
Query Parameters
Type
Description
size
number
Number of items to retrieve.
page
number
Which page to retrieve. Default is 10.
sort
string
Field used for sorting results. Default is created.
from_date
number
Start date, timestamp format. Default is current date minus 15 days.
to_date
number
End date, timestamp format. Default is current date plus 15 days.
date_filter
string
Date field used to filter results. Default is created.
Request --
1
GET /users HTTP/1.1
2
Content-Type: application/json
3
Authorization: Bearer <service-account-key>
4
X-Builton-Api-Key: <builton-api-key>
5
Host: api.builton.dev
Copied!
Response --
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
4
[
5
{
6
"_id": {"$oid": "5a25250cd57ba213edcba515"},
7
"first_name": "Jane",
8
"last_name": "Doe",
9
"email": "[email protected]",
10
[...]
11
},
12
{
13
"_id": {"$oid": "5a25250cd57ba256dgrte432"},
14
"first_name": "John",
15
"last_name": "Doe",
16
"email": "[email protected]",
17
[...]
18
},
19
]
Copied!
1
builton.users.get().then(page => {
2
console.log(page.current); // First page
3
});
4
5
/*
6
[
7
User {
8
id: '5a25250cd57ba213edcba515',
9
first_name: Jane,
10
last_name: Doe,
12
[...]
13
},
14
User {
15
id: '5a25250cd57ba256dgrte432',
16
first_name: John,
17
last_name: Doe,
19
[...]
20
},
21
]
22
*/
Copied!

Update a User

Parameters
HTTP
Node SDK
Path Parameter
Type
Description
<user_id>
string
User ID
Body Parameters
Type
Description
first_name
string
First name of the user.
last_name
string
Last name of the user.
salutation
string
Title of the user.
email
string
E-mail of the user.
mobile_phone_number
string
Phone number of the user.
default_payment_method
string
Default payment method of the user.
addresses
array
An arrayof Addressesassociated with the user.
billing_address
object
Address used for billing purposes.
bio
string
Biographical note about the user.
tags
array
List of tags associated with the user.
notes
string
Additional notes regarding the user.
image
string
An Image ID
Request --
1
PUT /users/5a25250cd57ba213edcba515 HTTP/1.1
2
Content-Type: application/json
3
Authorization: Bearer <service-account-key>
4
X-Builton-Api-Key: <builton-api-key>
5
Host: api.builton.dev
6
7
{
8
"first_name": "Oliver"
9
}
Copied!
Response --
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
4
{
5
"_id":{"$oid":"5a25250cd57ba213edcba515"},
6
"first_name":"Oliver",
7
"last_name":"Doe",
8
"email":"[email protected]",
9
[..]
10
}
Copied!
1
builton.users.update('5a25250cd57ba213edcba515', {
2
first_name: "Oliver"
3
});
4
5
// OR, if you already have a user stored in a variable:
6
user.update({
7
first_name: 'Oliver'
8
}).then(console.log);
9
10
/*
11
User {
12
id: '5a25250cd57ba213edcba515',
13
first_name: Oliver,
14
last_name: Doe,
16
[...]
17
*/
Copied!

Update a User's Addresses

Parameters
HTTP
Node SDK
Path Parameter
Type
Description
<user_id>
string
User ID
Body Parameters
Type
Description
addresses
array
An arrayof Addressesassociated with the user.
Request --
1
PUT /users/5a25250cd57ba213edcba515/addresses HTTP/1.1
2
Content-Type: application/json
3
Authorization: Bearer <service-account-key>
4
X-Builton-Api-Key: <builton-api-key>
5
Host: api.builton.dev
6
7
[
8
{
9
"city":"Oslo",
10
"service":"google",
11
"alias":"",
12
"country":"Norway",
13
"zip_code":"0182",
14
"street_name":"Hausmanns gate 29"
15
}
16
]
Copied!
Response --
1
HTTP/1.1 200 OK
2
Content-Type: application/json
3
4
{
5
"_id":{"$oid":"5a25250cd57ba213edcba515"},
6
"first_name":"Oliver",
7
"last_name":"Doe",
8
"addresses": [
9
{
10
"zip_code": "0182",
11
"alias": "",
12
"geo": [
13
59.91764119999999,
14
10.7540584
15
],
16
"street_name": "Hausmanns gate 29",
17
"service": "google",
18
"country": "Norway",
19
"raw": {
20
"plus_code": {
21
"compound_code": "WQ93+3J Oslo, Norway",
22
"global_code": "9FFGWQ93+3J"
23
},
24
"geometry": {
25
"location": {
26
"lat": 59.91764119999999,
27
"lng": 10.7540584
28
},
29
"location_type": "ROOFTOP",
30
"viewport": {
31
"northeast": {
32
"lat": 59.9189901802915,
33
"lng": 10.7554073802915
34
},
35
"southwest": {
36
"lat": 59.91629221970849,
37
"lng": 10.7527094197085
38
}
39
}
40
},
41
"types": [
42
"street_address"
43
],
44