# Basic Information

### Query Market Categories

This endpoint retrieves the list of available market categories (topics) on the platform. These categories are used to organize markets and make them easier for users to discover. When creating a new market, you must specify a valid category ID from this list.

**Use Case:** Call this endpoint to populate a category dropdown when building a market creation form, or to display category filters on a market discovery page.

| Property           | Value                          |
| ------------------ | ------------------------------ |
| **Method**         | `GET`                          |
| **Path**           | `/api/market/openapi/category` |
| **Authentication** | Not Required                   |

{% tabs %}
{% tab title="cURL" %}

```bash
curl -X GET "https://apidev.forepass.org/api/market/openapi/category"
```

{% endtab %}

{% tab title="Node.js" %}

```javascript
const response = await fetch(
  `${baseUrl}/api/market/openapi/category`
);

const categories = await response.json();

// Build a category dropdown
const categoryOptions = categories.data.map(cat => ({
  value: cat.id,
  label: cat.name
}));

console.log('Available categories:', categoryOptions);
```

{% endtab %}

{% tab title="Python" %}

```python
response = requests.get(
    f'{base_url}/api/market/openapi/category'
)

categories = response.json()

# Build a category dropdown
category_options = [
    {'value': cat['id'], 'label': cat['name']}
    for cat in categories['data']
]

print('Available categories:', category_options)
```

{% endtab %}

{% tab title="Response" %}

```json
{
  "code": 200,
  "msg": "success",
  "data": [
    {
      "id": 1,
      "name": "Business"
    },
    {
      "id": 2,
      "name": "Creators"
    },
    {
      "id": 3,
      "name": "Crypto"
    },
    {
      "id": 4,
      "name": "Politics"
    },
    {
      "id": 5,
      "name": "Sports"
    },
    {
      "id": 9,
      "name": "Entertainment"
    },
    {
      "id": 10,
      "name": "Other"
    }
  ]
}
```

{% endtab %}
{% endtabs %}

{% hint style="success" %}
**Tip:** Cache this response in your application as categories rarely change. Refresh once per day or on application startup.
{% endhint %}

**Response Fields:**

| Field  | Type   | Description                                                             |
| ------ | ------ | ----------------------------------------------------------------------- |
| `id`   | number | The unique identifier for the category. Use this when creating markets. |
| `name` | string | The display name of the category.                                       |

**HTTP Status Codes:**

| Code  | Description                                       |
| ----- | ------------------------------------------------- |
| `200` | Categories retrieved successfully.                |
| `500` | Internal server error. Retry after a short delay. |

**Possible Errors:**

This endpoint rarely fails as it doesn't require authentication. If you receive a `500` error, implement exponential backoff and retry.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.forepaas.org/api-reference/api-reference/basic-information.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
