Validate an address
POST /v2/fulfillment/lastmile/users/{user_id}/validate_address
This endpoint has been replaced by Create a Connect user and validate an address, which checks for the user and, if the user already exists, validates the address. This change reflects our commitment to making our API more intuitive to use when implementing multiple fulfillment workflows in your ecommerce site. The deprecated endpoint is still supported for existing implementations. For new implementations, use the revised endpoint.
Validates an address for a user. Send this request before you create an order to reduce the possible errors that can be returned from the order creation endpoint. When you create the order, ensure that you use the validated address.
Alternatively, create a user and validate an address in one request.
Security
Name | In | Description |
---|---|---|
Authorization | header | The Authorization header with the bearer token acquired during authentication. |
Parameters
Name | In | Type | Required | Description |
---|---|---|---|---|
user_id | path | string | The ID of the user. |
Request
Field | Type | Required | Description |
---|---|---|---|
address_line_1 | string | The first address line. | |
address_line_2 | string | The second address line. | |
address_type | string | The type of address, e.g., "residential". | |
postal_code | string | The postal/zip code of the address. |
Request examples
- cURL
- Java
- Python
- Go
curl --request POST \
--url 'https://connect.instacart.com/v2/fulfillment/lastmile/users/{user_id}/validate_address' \
--header 'Accept: application/json' \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"address_line_1": "string",
"address_line_2": "string",
"address_type": "string",
"postal_code": "string"
}'
HttpResponse<String> response = Unirest.post("https://connect.instacart.com/v2/fulfillment/lastmile/users/{user_id}/validate_address")
.header("Accept", "application/json")
.header("Content-Type", "application/json")
.header("Authorization", "Bearer <token>")
.body("{\n \"address_line_1\": \"string\",\n \"address_line_2\": \"string\",\n \"address_type\": \"string\",\n \"postal_code\": \"string\"\n}")
.asString();
import http.client
conn = http.client.HTTPSConnection("connect.instacart.com")
payload = "{\n \"address_line_1\": \"string\",\n \"address_line_2\": \"string\",\n \"address_type\": \"string\",\n \"postal_code\": \"string\"\n}"
headers = {
'Accept': "application/json",
'Content-Type': "application/json",
'Authorization': "Bearer <token>"
}
conn.request("POST", "/v2/fulfillment/lastmile/users/{user_id}/validate_address", 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/lastmile/users/{user_id}/validate_address"
payload := strings.NewReader("{\n \"address_line_1\": \"string\",\n \"address_line_2\": \"string\",\n \"address_type\": \"string\",\n \"postal_code\": \"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 |
---|---|---|---|
address_line_1 | string | The first address line. | |
postal_code | string | The postal/zip code of the address. | |
flags | Flags | Additional properties of the address. |
Flags Object
Field | Type | Required | Description |
---|---|---|---|
long_distance_delivery | boolean | Whether a delivery to the address will be a long distance delivery. |
Response examples
200 Success
200
Address created
{
"address_line_1": "499 Gainsville",
"postal_code": "81910",
"flags": {
"long_distance_delivery": false
}
}
4XX Errors
Error responses return either a single error or multiple errors.
HTTP Code | Cause | Error Message | Error Code | Error Meta |
---|---|---|---|---|
400 | Invalid input* | "There were issues with your request" | 9999 | Not applicable |
400 | Address not serviceable | "Address is not serviceable." | 1001 | {"key":"address_line_1"} |