Skip to main content

Search

Endpoints for searching content within a single tenant or across all tenants the user belongs to.

info

Both search endpoints require the storefront_search feature flag to be enabled on the tenant. If disabled, the endpoint returns 204 No Content.


Store Search (Single Tenant)

GET /api/v2/search/store

Searches content within a specific tenant. Uses single-tenant mode (requires X-Farfalla-Tenant-Id).

Request:

curl "https://app.publica.la/api/v2/search/store?query=governor" \
-H "Authorization: Bearer {access_token}" \
-H "X-Farfalla-Tenant-Id: 42" \
-H "Accept: application/json"
ParameterTypeRequiredDescription
querystring (2-128 chars)YesSearch term. Normalized to NFC form to handle accented characters consistently
scopestringNoowned (default) returns only the user's library; all returns the storefront with commerce fields

Response: 200 OK

{
"filter_name": "search",
"filter_value": "governor",
"title": "Search...",
"data": [
{
"id": 153598,
"tenant_id": 42,
"name": "The Governor and the Rebel",
"slug": "the-governor-and-the-rebel",
"cover_url": "https://cdn.publica.la/issues/cover.jpg",
"published_at": "2020-11-20 03:00:00",
"type": "epub",
"description": "A historical novel...",
"external_id": "9786599001772",
"number_of_pages": 30,
"lang": "pt",
"author": "Azevedo, Israel Belo De",
"publisher": "Editora Prazer Da Palavra",
"bisac": "Fiction > Historical"
}
],
"meta": {
"current_page": 1,
"from": 1,
"to": 1,
"last_page": 1,
"per_page": 8,
"total": 1
}
}

When scope=all is set, every issue object additionally carries can_be_read, can_be_bought, free, prices, purchase_link, and status. See Commerce > Commerce Fields for details. Only acquirable content (free or with individual prices) is returned; subscription-only content is excluded.

No results:

{
"filter_name": "search",
"filter_value": "nonexistent",
"title": "Search...",
"data": [],
"meta": {
"current_page": 1,
"from": null,
"to": null,
"last_page": 1,
"per_page": 8,
"total": 0
}
}

Global Search (All Tenants)

GET /api/v2/search/global

Searches content across all tenants where the user has an account. Uses multi-tenant mode (do NOT send X-Farfalla-Tenant-Id).

Request:

curl "https://app.publica.la/api/v2/search/global?query=governor" \
-H "Authorization: Bearer {access_token}" \
-H "Accept: application/json"
ParameterTypeRequiredDescription
querystring (2-128 chars)YesSearch term

Response: Same structure as store search. Results include tenant_id on each item to identify which tenant the content belongs to.

info

Global search is multi-tenant and never returns commerce fields, even if scope=all is sent. Pricing and purchase URLs depend on tenant context, which only single-tenant endpoints can provide.


See Also

  • Library - Browse content by section
  • Reader - Open and read found content
  • Commerce - Storefront mode and commerce fields
X

Graph View