# Introduction to the Second API

The Second REST API lets other software read and write the data of a Second marketplace: listings, users, bookings, requests for proposal, messages, reviews. This page is for integrators. It covers authentication, the main resources and the common conventions.

Source: https://www.scnd.com/docs/api
Last updated: 2026-12-03

## Before you start

- **The API must be open.** The marketplace operator turns on the API in their back office.
- **A registered application.** The operator registers your application and gives you its key and secret. They also choose which access modes and scopes are allowed. See [Connect third-party services](https://www.scnd.com/docs/operators/integrations).
- **The marketplace's address.** All routes start with `/api/v2` after the marketplace's address.

## What can the API do?

| Resources | Example uses |
|---|---|
| Accounts and users | Register a user, read or edit their profile, search for vendors |
| Listings | Search for listings, create them, edit their calendar, upgrades or translations |
| Favourites and alerts | Save listings, create search alerts |
| Bookings and payments | Calculate a price, book, accept or decline, pay by card through Stripe |
| Requests for proposal | Publish a request for proposal |
| Messages and reviews | Read and write messages, leave a review |
| Invoices and indicators | Read your invoices and your dashboard indicators |
| Public content and settings | Read pages, menus, and the available languages and currencies |

The API is split into two areas. The **user** area acts on behalf of a customer or a vendor, with their permissions. The **administration** area, under `/api/v2/admin`, is for the operator: moderating listings, reviews and messages, and managing users, categories and bookings.

## Authenticate with OAuth2

Second uses the OAuth2 protocol. Your application obtains an access token, then sends it in the `Authorization` header of each call.

| Access mode | When to use it |
|---|---|
| **Authorization code** (with PKCE) | Your application acts on behalf of a user, who gives their consent on the marketplace. |
| **Client credentials** | Software calls the API without a user, for example a nightly synchronisation. |
| **Refresh token** | Get a new access token without asking the user for consent again. |

There are two scopes: `private` for a user's data and `admin` for the administration API. By default, an access token is valid for 1 hour and a refresh token for 1 month.

Example of obtaining a token, with the values provided by the operator:

```bash
curl -X POST "https://your-marketplace.example/api/v2/oauth2/token" \
  -H "Content-Type: application/x-www-form-urlencoded" \
  -d "grant_type=client_credentials" \
  -d "client_id=YOUR_KEY" \
  -d "client_secret=YOUR_SECRET" \
  -d "scope=private"
```

```json
{
  "token_type": "Bearer",
  "expires_in": 3600,
  "access_token": "<token>"
}
```

> **Watch out.**
> Keep your application's secret on the server side. Never embed it in a mobile app or a web page. For those cases, use the authorization code with PKCE.

<details class="docs-more">
<summary>Sign in with a user's credentials</summary>

An application belonging to the marketplace itself can also sign a user in with their email address and password. It receives a token valid for 1 hour, which can be renewed. Access to the administration API then requires an administrator account that is allowed to use the API.

</details>

## Make a call

Example of a listing search, page 1, 20 results per page, in French:

```bash
curl "https://your-marketplace.example/api/v2/listings/search?page=1&length=20&locale=fr" \
  -H "Authorization: Bearer <token>" \
  -H "Accept: application/json"
```

A list always returns the same envelope:

```json
{
  "_links": {
    "self":  { "href": "/api/v2/listings/search?page=1&length=20" },
    "first": { "href": "/api/v2/listings/search?page=1&length=20" },
    "next":  { "href": "/api/v2/listings/search?page=2&length=20" },
    "last":  { "href": "/api/v2/listings/search?page=5&length=20" }
  },
  "metadata": {
    "pagination": { "page": 1, "per_page": 20, "total": 94 }
  },
  "items": [ { "id": "…", "title": "…" } ]
}
```

## Which conventions apply?

- **Format.** Requests and responses are in JSON. The language is chosen with the `locale` parameter or the `Accept-Language` header.
- **Pagination.** The `page` and `length` parameters (from 1 to 100) split lists into pages. A partial response has the status `206`. A page beyond the last one returns `416`.
- **Errors.** An error returns a `{type, title, status, detail}` object. Invalid data returns `422`, with the list of fields at fault. An action refused by a business rule returns `406`.
- **Rate limits.** Some actions are limited in number per period, according to the operator's settings. Beyond that, the API returns `429`: wait before trying again.
- **Statuses.** The statuses of bookings, bids and listings are the same as in the interface: see [Statuses](https://www.scnd.com/docs/reference/statuses).

> **Tip.**
> The operator can open interactive API documentation, at the marketplace's `/api/v2/doc` address. It lists all the routes of their marketplace, with their parameters.

## Get notified of events

Instead of polling the API at regular intervals, your application can receive a message for each important event, such as a paid booking. See [Webhooks](https://www.scnd.com/docs/api/webhooks).
