> For the complete documentation index, see [llms.txt](https://docs.sportmonks.com/v3/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.sportmonks.com/v3/tutorials-and-guides/tutorials/filter-and-select-fields/selecting-and-filtering.md).

# Selecting and filtering

Thanks to the API flexibility, you can select specific fields and filter simultaneously!

Let’s continue with our events example from the last section: we want all the goal and substitution events:

{% code overflow="wrap" %}

```javascript
https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=events.type&filters=eventTypes:18,14
```

{% endcode %}

{% hint style="info" %}
This time we’ve used the include events.type to have the name of the event type included in the response. More information about this can be found in our nested include tutorial.
{% endhint %}

Now, the events include contains a lot of information we’re not interested in. Frankly, we’re only interested in the name of the players related to the event and the minute the event occurred. As you’ve learnt, we can select all the fields on the base entity.&#x20;

In our example, the events entity. We need the `“player_name”,` `“related_player_name”` and `“minute”` field. This results in the following steps:

1. Add the include: `&include=events`&#x20;
2. Determine the fields you’re interested in: `“player_name”,` `“related_player_name”` and `“minute”` field.&#x20;
3. Select the fields: `&include=events:player_name,related_player_name,minute`

The above steps result in the following request:

{% code overflow="wrap" %}

```javascript
https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=events:player_name,related_player_name,minute
```

{% endcode %}

Now, add the filter from the previous filter request: `&filters=eventTypes:18,14`

{% code overflow="wrap" %}

```javascript
https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=events:player_name,related_player_name,minute&filters=eventTypes:18,14
```

{% endcode %}

<details>

<summary>Response</summary>

```javascript
{
  "data": {
    "id": 18535517,
    "sport_id": 1,
    "league_id": 501,
    "season_id": 19735,
    "stage_id": 77457866,
    "group_id": null,
    "aggregate_id": null,
    "round_id": 274719,
    "state_id": 5,
    "venue_id": 8909,
    "name": "Celtic vs Rangers",
    "starting_at": "2022-09-03 11:30:00",
    "result_info": "Celtic won after full-time.",
    "leg": "1/1",
    "details": null,
    "length": 90,
    "placeholder": false,
    "last_processed_at": "2023-02-17 10:19:55",
    "has_odds": true,
    "starting_at_timestamp": 1662204600,
    "events": [
      {
        "id": 42683644,
        "type_id": 18,
        "sub_type_id": null,
        "fixture_id": 18535517,
        "player_id": 3298,
        "related_player_id": 10966261,
        "period_id": 4296154,
        "participant_id": 53,
        "player_name": "Aaron Mooy",
        "related_player_name": "R. Hatate",
        "minute": 73
      },
      {
        "id": 42683195,
        "type_id": 18,
        "sub_type_id": null,
        "fixture_id": 18535517,
        "player_id": 319282,
        "related_player_id": 9939171,
        "period_id": 4296154,
        "participant_id": 53,
        "player_name": "Daizen Maeda",
        "related_player_name": "L. Abada",
        "minute": 73
      },
 //And more 
```

</details>

{% hint style="info" %}
Please note that if you also want the name of the event type you need to add the `events.type` include as well.

`https://api.sportmonks.com/v3/football/fixtures/18535517?api_token=YOUR_TOKEN&include=events:player_name,related_player_name,minute;event.type&filters=eventTypes:18,14`
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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.sportmonks.com/v3/tutorials-and-guides/tutorials/filter-and-select-fields/selecting-and-filtering.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.
