# Merchant Category

The Merchant Category resource is used to query the merchant categories available in the Stark Infra API.

A category is identified either by its code, which specifies a single MCC, or by its type, which defines an entire group of merchant codes, such as "food" or "services".

Use these codes and types to define the category filters of the issuing rules of your [Issuing Holder resource](https://docs.starkinfra.com/api/v2/issuing-holder.md) and [Issuing Card resource](https://docs.starkinfra.com/api/v2/issuing-card.md). A category filter must define exactly one parameter between code and type.

**Note:** Merchant categories are never created by you. They are an enum served by the API, so this resource is query-only.

### The Merchant Category object

**Attributes**

| Name | Type | Description |
| --- | --- | --- |
| `code` | STRING | Category's code, which specifies a single MCC. Example: "fastFoodRestaurants". |
| `type` | STRING | Category's type, which defines an entire group of merchant codes. Options: "unknown", "pets", "food", "fuel", "retail", "health", "hotels", "leisure", "services", "clothing", "gambling", "airlines", "carRental", "education", "groceries", "financial", "government", "organizations", "transportation". Example: "food". |
| `name` | STRING | Category's name, translated to the language of the Accept-Language header. Example: "Fast food restaurants". |
| `number` | STRING | Category's number. Example: "5814". |

### List Merchant Categories

`GET /v2/merchant-category`

Get a list of the merchant categories available in the Stark Infra API. Either codes, which specify single MCCs, or types, which define entire groups of merchant codes, will be accepted as category filters in your issuing rules.

**NOTE:** This route returns the full enum in a single response. It is not paginated, so it accepts no limit or cursor parameters and returns no cursor.

**Parameters**

| Name | Required | Description |
| --- | --- | --- |
| `search` | OPTIONAL | Keyword to search for code, type, name or number. The match is case- and accent-insensitive. Example: "food" |
| `fields` | OPTIONAL | List of strings to filter response JSON keys. Not available in the SDKs. |

**Request**

```python
import starkinfra

categories = starkinfra.merchantcategory.query(
    search="food"
)

for category in categories:
    print(category)
```

**Response**

```python
MerchantCategory(
    code=fastFoodRestaurants,
    type=food,
    name=Fast food restaurants,
    number=5814
)
```

## Available Languages

Code samples on this page are in Python. The same content is available with samples in:

- [Python](https://docs.starkinfra.com/api/v2/merchant-category-python.md)
- [Node.js](https://docs.starkinfra.com/api/v2/merchant-category-node.md)
- [PHP](https://docs.starkinfra.com/api/v2/merchant-category-php.md)
- [Java](https://docs.starkinfra.com/api/v2/merchant-category-java.md)
- [Ruby](https://docs.starkinfra.com/api/v2/merchant-category-ruby.md)
- [Elixir](https://docs.starkinfra.com/api/v2/merchant-category-elixir.md)
- [.NET](https://docs.starkinfra.com/api/v2/merchant-category-dotnet.md)
- [Go](https://docs.starkinfra.com/api/v2/merchant-category-go.md)
- [Clojure](https://docs.starkinfra.com/api/v2/merchant-category-clojure.md)
- [cURL](https://docs.starkinfra.com/api/v2/merchant-category-curl.md)
