Skip to content

MRVDH/picnic-api

Repository files navigation

Picnic-API

npm version GitHub license MAAR3267

Unofficial Node.js wrapper for the API of the Picnic online supermarket. Not affiliated with Picnic.

Installation

npm install picnic-api

Quick start

Import the package and create a client. All configuration options are optional.

import PicnicClient from "picnic-api";

const picnicClient = new PicnicClient({
  countryCode: "NL", // The country code for the API. Options: "NL" (default) or "DE".
  apiVersion: "15",  // The API version (default "15").
  authKey: "...",    // An existing auth key to skip the login step.
  url: "...",        // A custom base URL (defaults to https://storefront-prod.<cc>.picnicinternational.com/api/<version>).
});

Authentication

Most endpoints require authentication. Call auth.login() to obtain an auth key, which is automatically stored in the client and sent with subsequent requests. If you already have a key from a previous session, pass it as authKey in the constructor instead.

await picnicClient.auth.login("email", "password");

Usage examples

// Search for products
const results = await picnicClient.catalog.search("Affligem blond");

// Add a product to the cart
await picnicClient.cart.addProductToCart(11295810, 2);

// Get available delivery slots
const slots = await picnicClient.cart.getDeliverySlots();

// Get details of a specific delivery
const delivery = await picnicClient.delivery.getDelivery("delivery-id");

Custom requests

For endpoints not yet covered by a domain service, use sendRequest directly:

await picnicClient.sendRequest("GET", "/unknown/route");
await picnicClient.sendRequest("POST", "/invite/friend", { email: "friend@example.com" });

API reference

The client exposes the following domain services, each grouping a set of related endpoints:

Service Accessor Description
App client.app Bootstrap data, pages, and deeplink resolution.
Auth client.auth Login, logout, 2FA, and phone verification.
Cart client.cart Cart management, delivery slots and selling units (recipes, meal plans, selling groups).
Catalog client.catalog Product search, suggestions, details, and images.
Consent client.consent Consent settings and GDPR declarations.
Content client.content Static content pages (FAQ, search empty state).
Customer Service client.customerService Contact info, messages, reminders, and parcels.
Delivery client.delivery Delivery history, live position, ratings, and invoices.
Payment client.payment Payment profile and wallet transactions.
Recipe client.recipe Recipe browsing and saving.
User client.user User details, profile, suggestions, and push tokens.
User Onboarding client.userOnboarding Household/business details and push subscriptions.

Each service method is fully typed — explore the type definitions under src/domains/<service>/types.ts for request and response shapes.

Contributing

Contributions are welcome! Please read the CONTRIBUTING.md file for guidelines.

If you enjoy this package, consider using the discount code MAAR3267 so we both get a discount on our next order. 😄

About

Unofficial Node.js wrapper for the API of the Picnic online supermarket. Not affiliated with Picnic.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Packages