Create a Connect user account
POST /v2/fulfillment/users
Creates a Connect user account with the user ID specified in the body of the request. The user ID is defined by your site and can be any unique identifier, such as a login name, loyalty ID, or email address.
Instacart uses the user ID to link together multiple API requests. For example, when you reserve a time slot or create an order, you specify the user ID in the request path. You might also need the user ID when troubleshooting issues.
The Connect user account is separate from the retailer customer account and the customer's Instacart account. You can, however, choose to store the Connect user IDs with your other customer account information and reuse them. You can also choose to implement Account linking and invite customers to link their Instacart account.
Security
Name | In | Description |
---|---|---|
Authorization | header | The Authorization header with the bearer token acquired during authentication. |
Parameters
None.Request
Field | Type | Required | Description |
---|---|---|---|
user_id | string | Unique user ID to use for this user. | |
first_name | string | The user's first name. Note this field does not support special characters /:<>$%?. | |
last_name | string | The user's last name. Note this field does not support special characters /:<>$%?. | |
phone_number | string | The user's phone number. | |
locale | string | The user's locale in IETF Language Tag format. Example: en-US. |
Request examples
- cURL
- Java
- Python
- Go
curl --request POST \
--url https://connect.instacart.com/v2/fulfillment/users \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"user_id": "string",
"first_name": "string",
"last_name": "string",
"phone_number": "string",
"locale": "string"
}'
HttpResponse<String> response = Unirest.post("https://connect.instacart.com/v2/fulfillment/users")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.header("Authorization", "Bearer <token>")
.body("{\n \"user_id\": \"string\",\n \"first_name\": \"string\",\n \"last_name\": \"string\",\n \"phone_number\": \"string\",\n \"locale\": \"string\"\n}")
.asString();
import http.client
conn = http.client.HTTPSConnection("connect.instacart.com")
payload = "{\n \"user_id\": \"string\",\n \"first_name\": \"string\",\n \"last_name\": \"string\",\n \"phone_number\": \"string\",\n \"locale\": \"string\"\n}"
headers = {
'Accept': "application/json",
'Content-Type': "application/json",
'Authorization': "Bearer <token>"
}
conn.request("POST", "/v2/fulfillment/users", payload, headers)
res = conn.getresponse()
data = res.read()
print(data.decode("utf-8"))
package main
import (
"fmt"
"strings"
"net/http"
"io/ioutil"
)
func main() {
url := "https://connect.instacart.com/v2/fulfillment/users"
payload := strings.NewReader("{\n \"user_id\": \"string\",\n \"first_name\": \"string\",\n \"last_name\": \"string\",\n \"phone_number\": \"string\",\n \"locale\": \"string\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Accept", "application/json")
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := ioutil.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}
Response
Field | Type | Required | Description |
---|---|---|---|
user_id | string | The ID of the user. | |
first_name | string | The user's first name. | |
last_name | string | The user's last name. | |
phone_number | string | The user's phone number. | |
locale | string | The user's locale in POSIX format. Example: en_US. |
Response examples
200 Success
200
User created
{
"user_id": "roberteospeedwagon",
"first_name": "Robert",
"last_name": "Speedwagon",
"phone_number": "5555555555",
"locale": "en_CA"
}
4XX Errors
Error responses return either a single error or multiple errors.
HTTP Code | Cause | Error Message | Error Code | Error Meta |
---|---|---|---|---|
400 | Without first name | "can't be blank" | 1001 | {"key":"first_name"} |
400 | Invalid first name | "First name is invalid" | 1001 | {"key":"first_name"} |
400 | Invalid last name | "Last name is invalid" | 1001 | {"key":"last_name"} |
400 | Without user id | "can't be blank" | 1001 | {"key":"user_id"} |
400 | User already created | "A user with this id has already been created" | 1001 | {"key":"user_id"} |
400 | Invalid locale provided | "Unsupported locale" | 1001 | {"key":"locale"} |
404 | Resource not found | "Resource not found" | 4000 | Not applicable |
423 | The target resource is locked | "The target resource is locked." | null | {"key":"user_id"} |