Product API
Fulfillment guide
Service Options
Pickup Options

Pickup options

List timeslots for Delivery

GET api.foodin.ai/users/{user_id}/service_options/cart/pickup

Lists the available pickup service options for the customer's location and cart items. In this context, service options are time slots, such as Within 5 hours or Friday 9am-11am. Availability is based on current and anticipated deliverer availability for the relevant store location. The list includes immediate and scheduled time slots.

After a time slot is selected, save the service_option_id. You specify the ID when reserving the time slot.

Parameters

FieldTypeDescription
user_idstringThe ID of the user.

Request

FieldTypeDescription
ItemsArray(items)The items for delivery.
location_codestringThe location code of the store fulfilling the order.
with_eta_optionsbooleanReturns ETA options instead of immediate when true. Defaults to false.

Items Object

FieldTypeDescription
line_numStringThe item's line number in the order.
countIntegerThe count of the item. Must be a non-negative integer.
weightnumberThe weight of the item (defaults to kg in the US). Must be a non-negative number.
special_instructionsstringAny special instructions about the item selection.
replacement_policystringOne of "no_replacements", "users_choice" (default if replacement_items specified), or "deliverers_choice" (default otherwise).
replacement_itemsArrayA list of requested replacement items if the original item could not be found. This field needs to be turned on via configuration.
itemObjectThe item's code.

Replacement_items Object

FieldTypeDescription
upcstringThe item's universal product code (upc).

Item Object

FieldTypeDescription
upcstringThe item's universal product code (upc).

Request examples

var request = require("request");
 
var options = {
  method: "POST",
  url: "https://api.foodin.ai/users/{user_id}/service_options/cart/pickup",
  headers: {
    Accept: "application/json",
    Authorization: "Bearer <token>",
    "Content-Type": "application/json",
  },
  body: {
    items: [
      {
        line_num: "string",
        count: 1,
        weight: 1,
        special_instructions: "string",
        replacement_policy: "no_replacements",
        replacement_items: [
          {
            upc: "string",
          },
        ],
        item: {
          upc: "string",
        },
      },
    ],
    location_code: "string",
    with_eta_options: true,
  },
  json: true,
};
 
request(options, function (error, response, body) {
  if (error) throw new Error(error);
 
  console.log(body);
});

Response

FieldTypeDescription
service_optionsArrayThe item's line number in the order.
warningsIntegerThe count of the item. Must be a non-negative integer.
flagsObjectAdditional properties of the address.

Service_options Object

FieldTypeDescription
idintegerThe ID of the service option.
service_option_referenceStringThe reference of the service option.
dateStringThe date the service will take place in ISO 8601 format.
handoff_timeStringThe ETA for deliverer to arrive at store.
WindowObjectThe time window when the service will take place.
AvailabilityObjectThe availability of this service option.

Windows Object

FieldTypeDescription
availablebooleanIndicates if this service option is available for the user.
reasonsArrayThe reasons for unavailability of a service option. Currently, the reasons are related to the laws governing the sale of alcohol. For example, restrictions on quantity, delivery time, pickup, and matched city and county of stores and customers. The reasons are subject to change without notice.
item_codesArrayThe item codes which caused the option to be unavailable.

Availability Object

FieldTypeDescription
start_atstringThe start of the delivery window in ISO 8601 format.
end_atstringThe end of the delivery window in ISO 8601 format.
typestringThe type of service option. One of 'scheduled', 'eta' or 'asap’.
asapbooleanIndicates if delivery will happen as soon as possible. Only true when type is asap.

Reasons for unavailability of a service option

ReasonDescription
State law restricts amount of {beer/wine/spirits} to {#} fl oz, cart quantity is: {#} fl oz.The quantity of this alcohol type exceeds the country/state law limit..
Error validating alcohol quantities. Please try again.The quantity of alcohol can’t be validated.
Unmatched city and countyThe city and county of the store and customer must match.
Unfortunately alcohol pickup is not available at this location. Please remove alcohol from your basket or try delivery.Alcohol pickup is not available at this location.

Response examples

{
  "service_options": [
    {
      "id": 210,
      "service_option_reference": "ezppZD0-MjEwLCA6dHlwZT0-IlBpY2t1cE9wdGlvbiIsIDp3aW5kb3c9PjxJbnN0YWNhcnQ6OkVudGVycHJpc2U6OkJvYmE6OkNvcmU6OlR5cGVzOjpWMTo6U2VydmljZU9wdGlvblNjaGVkdWxlZFdpbmRvdzogZGVzY3JpcHRvcjogIiIsIHN0YXJ0X2F0OiA8R29vZ2xlOjpQcm90b2J1Zjo6VGltZXN0YW1wOiBzZWNvbmRzOiAxNTE5MjU3NjAwLCBuYW5vczogMD4sIGVuZF9hdDogPEdvb2dsZTo6UHJvdG9idWY6OlRpbWVzdGFtcDogc2Vjb25kczogMTUxOTI2NDgwMCwgbmFub3M6IDA-Pn0=",
      "date": "2022-02-22",
      "window": {
        "start_at": "2022-02-22T00:00:00Z",
        "end_at": "2022-02-22T02:00:00Z",
        "type": "scheduled",
        "asap": false
      },
      "availability": {
        "available": true,
        "reasons": [],
        "item_codes": []
      }
    },
    {
      "id": 211,
      "service_option_reference": "ezppZD0-MjExLCA6dHlwZT0-IlBpY2t1cEV0YU9wdGlvbiIsIDp3aW5kb3c9PjxJbnN0YWNhcnQ6OkVudGVycHJpc2U6OkJvYmE6OkNvcmU6OlR5cGVzOjpWMTo6U2VydmljZU9wdGlvblNjaGVkdWxlZFdpbmRvdzogZGVzY3JpcHRvcjogIiIsIGVuZF9hdDogPEdvb2dsZTo6UHJvdG9idWY6OlRpbWVzdGFtcDogc2Vjb25kczogMTUxOTI2NDgwMCwgbmFub3M6IDA-Pn0=",
      "date": "2022-02-22",
      "window": {
        "start_at": "2022-02-22T00:00:00Z",
        "end_at": "2022-02-22T02:00:00Z",
        "type": "eta",
        "asap": false
      },
      "availability": {
        "available": true,
        "reasons": [],
        "item_codes": []
      }
    }
  ],
  "warnings": []
}

4XX Errors

CodeCauseError Message
400User Not Found"User Not Found"
400Invalid location code"Specified store is not available for pickup."
400Invalid Quantity, expected weight"One of these items had an invalid quantity amount, 0001234567892 expected weight"
400Invalid items"1 item not found."
403User Not Active"User Not Active"
404Resource not found"Resource not found"