# Access to Sell

## Overview

**Access to sell** defines how users enter the resale flow from your *My Tickets* section to list or manage their tickets.

The primary integration for sell access is the **Smart Access Layer (SAL)**.

{% callout type="info" title="Smart Access Layer" %}
You may also see the Smart Access Layer referred to as SAL in some parts of the documentation.
{% /callout %}

Your platform calls a high-priority endpoint with a list of tickets (or orders) and the user's identifier. menta tech responds, for each ticket or order, with:

- The current resale status (`SELLABLE`, `FOR_SALE`, `SOLD`, `NOT_SELLABLE`)
- The available actions as call-to-actions (e.g., sell, edit listing, view details)
- The URLs to execute those actions
- Optional UI components (e.g., sell banner)

Your UI uses this response to decide what to show for each ticket and where to send the user when they click. Ticket information is fetched on demand while the user views their tickets or starts a resale action, so menta does not add load to your primary onsales.

menta tech supports two models for Access to Sell:

- **Option 1** Smart Access Layer (recommended)
- **Option 2** Static resale entry URL

The underlying resale rules are the same. The choice is how tightly your *My Tickets* UI should connect to those rules.

## Integration models comparison

{% table highlight-first=true highlight-row=2 %}
| Model | Description | When it makes sense | Benefits | Limitations |
|--------|-------------|----------------------|-----------|--------------|
| Smart Access Layer (recommended) | Your backend calls the sell SAL endpoint with tickets or orders and user identity, and receives per-item status and CTAs | You want native resale actions and states inside *My Tickets* | Real-time per-ticket status, contextual actions, menta rule-driven logic, supports both ticket-level and order-level flows | Requires integrating the SAL call and wiring responses into your UI |
| Static resale entry URL | A single "Sell tickets" link sends users to a generic resale entry page on menta | You need minimal integration or a quick pilot | Very low implementation effort | No per-ticket state or actions in your *My Tickets* UI; the experience is handled entirely on menta |
{% /table %}

___

{% conditionaltabs id="tabs-1765307261094" %}
{% tab label="Smart Access Layer" %}

## Smart Access Layer (recommended)

### Concept

The **Smart Access Layer** lets your *My Tickets* view ask menta, for each ticket or order, what can be done right now and how to do it.

For every item you send, menta evaluates:

- Whether the ticket is eligible for resale, based on rules configured in the menta dashboard
- Whether it is already listed or sold
- Which action makes sense (e.g., list for sale, edit listing, view listing details, no action)
- Whether the seller needs to complete payout setup

The endpoint is designed as a high-priority path capable of handling large requests efficiently, with the performance needed for critical real-time actions.

### Endpoint

```
POST https://api.mentatech.io/v1/wrapper/accesslayer
```

**Headers:**

| Header          | Required | Description                          |
|-----------------|----------|--------------------------------------|
| Authorization   | Yes      | Your API key                         |
| Content-Type    | Yes      | `application/json`                   |

### Request modes

The sell SAL supports two request modes. You must provide **either** `tickets` **or** `orders` in the body, not both.

{% conditionaltabs id="tabs-sell-modes" %}
{% tab label="Tickets mode" %}

#### Tickets mode

Use this mode when your platform tracks individual tickets. You send each `ticketId` and menta returns per-ticket status and CTAs.

**Request body:**

| Field                    | Type     | Required | Description                                         |
|--------------------------|----------|----------|-----------------------------------------------------|
| user                     | string   | Yes      | Email of the user (the seller)                      |
| tickets                  | array    | Yes      | List of ticket items to evaluate                    |
| tickets[].eventId        | string   | Yes      | External event identifier                           |
| tickets[].showId         | string   | Yes      | External show identifier                            |
| tickets[].ticketId       | string   | Yes      | External ticket identifier                          |
| tickets[].ticketOptionId | string   | Yes      | Access category identifier                          |
| tickets[].priceTypeId    | string   | Optional | Price type identifier (when applicable)             |

**Request example:**

```json
POST /v1/wrapper/accesslayer
Authorization: YOUR_API_KEY

{
  "user": "seller@example.com",
  "tickets": [
    {
      "eventId": "evt-123",
      "showId": "show-456",
      "ticketId": "T001",
      "ticketOptionId": "GA"
    },
    {
      "eventId": "evt-123",
      "showId": "show-456",
      "ticketId": "T002",
      "ticketOptionId": "VIP",
      "priceTypeId": "standard"
    }
  ]
}
```

**Response example:**

```json
{
  "data": {
    "user": "seller@example.com",
    "tickets": [
      {
        "status": "SELLABLE",
        "ticketId": "T001",
        "ticketOptionId": "GA",
        "priceTypeId": "",
        "sync": true,
        "callToActions": [
          {
            "key": "SELL",
            "text": "Sell",
            "url": "https://sell-ticket.mentatickets.com/es/publish/65fdc7eb...?ticketSellerId=2&oneTimeToken=...&utm_source=sell&syncPage=true",
            "enabled": true
          }
        ]
      },
      {
        "status": "FOR_SALE",
        "ticketId": "T002",
        "ticketOptionId": "VIP",
        "priceTypeId": "standard",
        "sync": true,
        "callToActions": [
          {
            "key": "P2P",
            "text": "Peer to Peer",
            "url": "https://event.mentatickets.com/es/...?sellerId=...&ticketSellerId=2&utm_source=sell&syncPage=true",
            "enabled": true
          },
          {
            "key": "EDIT",
            "text": "Edit Listing",
            "url": "https://sell-ticket.mentatickets.com/es/list-item/...?listingId=...&ticketSellerId=2&oneTimeToken=...&utm_source=sell&syncPage=true",
            "enabled": true
          }
        ]
      }
    ],
    "components": [
      {
        "type": "banner",
        "class": "sellBanner",
        "sellBanner": {
          "title": "Sell your tickets",
          "description": "List your tickets on the marketplace",
          "image": "https://cdn.example.com/sell-banner.png",
          "visible": true,
          "colors": {
            "background": "#0A1F44",
            "text": "#FFFFFF"
          },
          "callToAction": {
            "text": "Start selling",
            "url": "https://sell-ticket.mentatickets.com/es/publish/...?ticketSellerId=2&utm_source=sell&syncPage=true",
            "enabled": true
          }
        }
      }
    ]
  },
  "errors": [],
  "status": 200
}
```

{% /tab %}

{% tab label="Orders mode" %}

#### Orders mode

Use this mode when your platform tracks orders (each order containing multiple tickets). You send each `orderId` with its ticket-category combinations, and menta returns an aggregated status and CTA per order.

**Request body:**

| Field                              | Type     | Required | Description                                         |
|------------------------------------|----------|----------|-----------------------------------------------------|
| user                               | string   | Yes      | Email of the user (the seller)                      |
| orders                             | array    | Yes      | List of order items to evaluate                     |
| orders[].orderId                   | string   | Yes      | External order identifier                           |
| orders[].eventId                   | string   | Yes      | External event identifier                           |
| orders[].showId                    | string   | Yes      | External show identifier                            |
| orders[].combinations              | array    | Yes      | Ticket option/price type combinations in the order  |
| orders[].combinations[].ticketOptionId | string | Yes   | Access category identifier                          |
| orders[].combinations[].priceTypeId    | string | Optional | Price type identifier                             |

**Request example:**

```json
POST /v1/wrapper/accesslayer
Authorization: YOUR_API_KEY

{
  "user": "seller@example.com",
  "orders": [
    {
      "orderId": "ORD-001",
      "eventId": "evt-123",
      "showId": "show-456",
      "combinations": [
        { "ticketOptionId": "GA" },
        { "ticketOptionId": "VIP", "priceTypeId": "standard" }
      ]
    }
  ]
}
```

**Response example:**

```json
{
  "data": {
    "user": "seller@example.com",
    "orders": [
      {
        "orderId": "ORD-001",
        "status": "SELLABLE",
        "callToActions": [
          {
            "key": "SELL",
            "text": "Sell",
            "url": "https://sell-ticket.mentatickets.com/es/publish/...?ticketSellerId=2&oneTimeToken=...&utm_source=sell&syncPage=true",
            "enabled": true
          }
        ]
      }
    ],
    "components": []
  },
  "errors": [],
  "status": 200
}
```

{% callout type="info" title="Order status aggregation" %}
When an order contains multiple tickets, menta evaluates each ticket individually and returns an aggregated status for the order using this decision cascade:

1. If all tickets are `NOT_SELLABLE` → order is `NOT_SELLABLE`
2. If any ticket is `SELLABLE` and some are already listed or sold → order is `SELLABLE` with a `MANAGE` CTA
3. If all tickets are `SELLABLE` (none listed or sold) → order is `SELLABLE` with a `SELL` CTA
4. If all listed/sold tickets share the same group and some are listed → order is `FOR_SALE` with an `EDIT` CTA
5. If all listed/sold tickets share the same group and all are sold → order is `SOLD` with a `DETAILS` CTA
6. If listed/sold tickets belong to different groups → order is `FOR_SALE` with a `MANAGE` CTA
{% /callout %}

{% /tab %}
{% /conditionaltabs %}

### Status reference

| Status         | Description                                                    |
|----------------|----------------------------------------------------------------|
| `SELLABLE`     | The ticket can be listed for sale. CTA: `SELL`                 |
| `NOT_SELLABLE` | The ticket cannot be listed (rules do not allow it)            |
| `FOR_SALE`     | The ticket has an active listing. CTAs: `EDIT`, `P2P`          |
| `SOLD`         | The ticket was sold through the marketplace. CTA: `DETAILS`    |

### Call-to-action reference

| Key                  | Text                  | Description                                                                |
|----------------------|-----------------------|----------------------------------------------------------------------------|
| `SELL`               | Sell                  | Link to start the listing flow for this ticket                             |
| `EDIT`               | Edit Listing          | Link to edit or view the active listing                                    |
| `DETAILS`            | View Listing Details  | Link to view sold listing details                                          |
| `P2P`                | Peer to Peer          | Share link for the listing (direct purchase link)                          |
| `PENDING_PAYOUT_INFO`| Pending Payout Info   | Seller needs to complete payout setup (appears alongside other CTAs)       |
| `MANAGE`             | Manage Tickets        | Link to the ticket management page (orders mode, mixed states)             |

### The `sync` field (tickets mode)

In tickets mode, each ticket in the response includes a `sync` boolean:

- `sync: true` — the ticket is already synchronized in menta's database.
- `sync: false` — the ticket is not yet in menta's database. The CTA URL includes `syncPage=true` so the frontend triggers synchronization before listing.

{% callout type="info" title="Unknown tickets" %}
menta does not store your ticket inventory permanently — it synchronizes tickets on demand when a user wants to sell. This means a `ticketId` you send may not yet exist in menta's database.

When a ticket is not yet known to menta, the sell SAL still evaluates its sellability using the configured resale rules for that event/show/category combination. If the rules allow listing, the response returns `SELLABLE` with `sync: false` and a CTA URL that triggers synchronization automatically. Your UI does not need to handle this differently — just render the CTA as usual and menta takes care of the rest.
{% /callout %}

### Components

The response includes a `components` array with optional UI elements. Currently, the sell SAL returns:

**Sell Banner** (`type: "banner"`, `class: "sellBanner"`)

A promotional banner encouraging the user to sell their tickets. Visibility is controlled by the rules configured in the menta dashboard.

| Field                      | Description                                  |
|----------------------------|----------------------------------------------|
| `sellBanner.title`         | Banner title text                            |
| `sellBanner.description`   | Banner description text                      |
| `sellBanner.image`         | Banner image URL                             |
| `sellBanner.visible`       | Whether the banner should be rendered         |
| `sellBanner.colors`        | Optional background and text colors          |
| `sellBanner.callToAction`  | CTA with text, URL, enabled flag, and colors |

### How to use it in your UI

Your *My Tickets* page should:

1. Resolve the list of tickets (or orders) for the current user.
2. Call the sell SAL endpoint with the items and the user's email.
3. For each ticket or order in the response:
   - Use `status` to display the current state (e.g., Available for sale, For Sale, Sold).
   - Render each entry in `callToActions` as an actionable button or link, using `text` as the label and `url` as the destination.
   - If `callToActions` is empty, do not show resale actions for that item.
4. If `components` contains a visible sell banner, render it in an appropriate location.

Because all eligibility logic and states are managed by rules in the menta dashboard, any change you make there is automatically reflected in SAL responses without code changes on your side.

### When this model makes sense

Use the Smart Access Layer when:

- You want resale to feel fully integrated in your *My Tickets* UI.
- You need real-time, per-ticket states like `SELLABLE`, `SOLD`, `FOR_SALE`.
- You want to control from the menta dashboard which events, shows, or categories have resale enabled.
- You prefer not to implement or maintain resale rules in your own code.
- You need to support both ticket-level and order-level sell flows.
{% /tab %}

{% tab label="Static resale URL" %}

## Static resale entry URL model

### Concept

The static entry model offers a single, generic entry point to resale from your platform. Instead of asking menta what to show for each ticket, you redirect users to a generic resale entry page.

**Typical flow:**

1. Add a "Sell tickets" button or menu item in your UI.
2. Point that button to a static resale entry URL provided by menta.
3. menta authenticates the user using your chosen authentication model.
4. Inside menta, the user sees eligible tickets and chooses which to list.

Your *My Tickets* page does not display resale actions or states per ticket. All resale interaction happens inside the menta experience.

### When this model makes sense

Use a static resale URL when:

- You want the smallest possible integration to start testing resale.
- You do not need per-ticket resale actions in your own *My Tickets* UI.
- You are running a pilot while planning a future migration to the SAL model.

### Benefits

- Very low implementation effort.
- No backend integration required beyond linking to the resale entry URL.
- A good starting point for small pilots or tight timelines.

### Limitations

- No per-ticket state or actions in your own UI.
- The user always enters a generic resale flow and must choose tickets within menta.
- Your platform does not reflect ticket-level resale rules defined in the dashboard.
{% /tab %}

{% /conditionaltabs %}
