GET/api/v4/sub-categories

List subcategories

Returns the full catalog of subcategories used to classify locations when creating or updating them.

Requires an API key. See Authentication for header format and key rotation.

Parameters

This endpoint takes no parameters.

Responses

200The full list of subcategory objects.
{
  "data": {
    "subcategories": [
      {
        "databaseId": 639,
        "id": "U3ViQ2F0ZWdvcnk6NjM5",
        "key": "3d-printing",
        "name": "3D Printing",
        "primary": true
      },
      {
        "databaseId": 4589,
        "id": "U3ViQ2F0ZWdvcnk6NDU4OQ==",
        "key": "3d-printing-service",
        "name": "3D printing service",
        "primary": true
      },
      {
        "databaseId": 3268,
        "id": "U3ViQ2F0ZWdvcnk6MzI2OA==",
        "key": "aadhaar-center",
        "name": "Aadhaar center",
        "primary": true
      }
    ]
  }
}
401Unauthenticated — missing or invalid API key.
429Rate limit exceeded. Retry after the `Retry-After` header value.

Returns the complete catalog of subcategories that classify a location's line of business. This account returns roughly 6,000 entries, so treat it as a large, mostly-static lookup — fetch it once, cache it, and refresh periodically rather than calling it inline on every create/update.

Each item carries:

  • databaseId — the integer to pass as subCategoryId when creating or updating a location, and to include in the additionalCategoryIds array for supplemental categories.
  • id — the Base64-encoded Relay identifier for the same record.
  • key — a URL-friendly slug of the category name.
  • name — the human-readable label.
  • primary — whether the category is eligible to be a location's primary subcategory.

Resolving a category before creating a location

When onboarding a location you usually know the business type as free text ("3D printing service") but createLocation expects a numeric subCategoryId. The pattern is: pull this list once, build a namedatabaseId map in your own code, then look up the id at create time.

const res = await fetch('https://listingsapi.com/api/v4/sub-categories', {
  headers: { Authorization: 'API ' + process.env.LISTINGSAPI_KEY },
});
const { data } = await res.json();
const byName = new Map(data.subcategories.map((s) => [s.name.toLowerCase(), s.databaseId]));

const subCategoryId = byName.get('3d printing service'); // 4589

To tag a location with more than one category, pass the primary in subCategoryId and up to 9 supplemental ids in additionalCategoryIds. See Create a location and Update a location for how these fields are consumed.

The response is a single unpaginated array. It counts against your account rate limit like any other call, so cache it rather than re-fetching per location; a 429 response includes a Retry-After header.

curl -X GET 'https://listingsapi.com/api/v4/sub-categories' \
  -H "Authorization: API $LISTINGSAPI_KEY"