aYOUne
← Marketing API

Coupons

Singular: Coupon — Base-URL: https://marketing-api.ayoune.app — Zugriff: CRUD — Maschinenlesbare Beschreibung (JSON · YAML)

play_circle Jetzt ausprobieren beta

Requests werden über den consumer-app Proxy an *.ayoune.app weitergeleitet. Tokens bleiben im Browser und werden pro Call mitgesendet.

Beispiel-Response (aufgezeichnet) Beispiel

Eine echte, zuvor aufgezeichnete GET /:id-Antwort dieses Endpunkts — nicht der Live-Call oben. Sensible Felder sind maskiert.

{
  "payload": {
    "_id": "6a72bda658ee2cdf18a10e7d",
    "coupon": "9X0V7E1",
    "multi": false,
    "valid_till": "2026-09-04T04:35:50.241Z",
    "limit": 1,
    "type": "fix",
    "used": 0,
    "min_revenue": 0,
    "isDraft": true,
    "createdAt": "2026-08-05T04:35:50.242Z",
    "updatedAt": "2026-08-05T04:35:50.242Z",
    "scanID": "T96GHFZY",
    "shares": []
  },
  "meta": {
    "links": [
      {
        "rel": "self",
        "href": "https://marketing-api.ayoune.app/coupons/6a72bda658ee2cdf18a10e7d",
        "method": "get",
        "title": "GET",
        "types": [
          "application/json",
          "application/yaml",
          "text/csv"
        ]
      }
    ],
    "relations": [
      {
        "rel": "Consumers",
        "title": "MODEL_CONSUMER",
        "href": "https://api.ayoune.app/crm/consumers",
        "method": "get",
        "types": [
          "application/json",
          "application/yaml",
          "text/csv"
        ],
        "right": "crm.consumers"
      },
      {
        "rel": "LoyaltyPrograms",
        "title": "MODEL_LOYALTYPROGRAM",
        "href": "https://api.ayoune.app/marketing/loyaltyprograms",
        "method": "get",
        "types": [
          "application/json",
          "application/yaml",
          "text/csv"
        ],
        "right": "marketing.loyaltyprograms"
      },
      {
        "rel": "Intermediaries",
        "title": "MODEL_INTERMEDIARY",
        "href": "https://api.ayoune.app/config/intermediaries",
        "method": "get",
        "types": [
          "application/json",
          "application/yaml",
          "text/csv"
        ],
        "right": "config.intermediaries"
      }
    ],
    "debugId": "6aa37dbde7af9185f0f6d630",
    "errors": [],
    "actions": [
      {
        "rel": "self",
        "action": "COPY",
        "title": "MODEL_COUPON",
        "href": "https://api.ayoune.app/marketing/coupons/6a72bda658ee2cdf18a10e7d/copy",
        "method": "post",
        "types": [
          "application/json",
          "application/yaml",
          "text/csv"
        ]
      },
      {
        "rel": "self",
        "action": "DELETE",
        "title": "MODEL_COUPON",
        "href": "https://api.ayoune.app/marketing/coupons/6a72bda658ee2cdf18a10e7d",
        "method": "delete",
        "types": [
          "application/json",
          "application/yaml",
          "text/csv"
        ]
      }
    ],
    "version": {
      "host": "2026.38.0",
      "core": "2026.334.1"
    },
    "rateLimit": {
      "limit": "2500",
      "remaining": "2245",
      "reset": "1789102955",
      "resetDate": "Fri Sep 11 2026"
    },
    "responseTime": 25.55377,
    "code": 200,
    "status": "success",
    "error": false
  }
}

Endpunkte

MethodePathBeschreibungRight
GET /coupons Liste mit Filtern/Paginierung marketing.coupons.view
GET /coupons/:id Einzelner Datensatz marketing.coupons.view
POST /coupons Neuen Datensatz erstellen marketing.coupons.new
PUT /coupons Datensatz aktualisieren marketing.coupons.edit
DELETE /coupons/:id Datensatz löschen marketing.coupons.delete

SDK

import { aYOUne } from '@tolinax/ayoune';
const ay = new aYOUne('pat_your_token');

// Alle abrufen
const list = await ay.marketing.coupons.find().limit(10).exec();

// Einzelnen Datensatz
const one = await ay.marketing.coupons.findById('OBJECT_ID').exec();

// Erstellen
const created = await ay.marketing.coupons.create({ name: 'Foo' });

Weiterführend