# Customizing output (/docs/basic-concepts/customizing-output)

Most objects have many fields, and you often need only a few. With `show` or `hide` you choose which fields come back, which makes responses smaller and faster, most of all for lists.

## Show only some fields [#show-only-some-fields]

`show` takes a comma-separated list of fields. Only those fields come back, plus the object's `url`, which is always kept.

```bash title="Request"
curl "https://api.comecero.com/api/v1/carts/0091307952465CafhFSTa1?show=subtotal,tax,total" \
  -H "Authorization: Bearer $COMECERO_TEST_TOKEN"
```

```json title="Response"
{
  "url": "https://api.comecero.com/api/v1/carts/0091307952465CafhFSTa1",
  "subtotal": 119.9,
  "tax": 9.38,
  "total": 129.28
}
```

## Hide some fields [#hide-some-fields]

`hide` does the opposite: every field comes back except the ones you name.

```bash title="Request"
curl "https://api.comecero.com/api/v1/carts/0091307952465CafhFSTa1?hide=items,customer" \
  -H "Authorization: Bearer $COMECERO_TEST_TOKEN"
```

<Callout>
You cannot send `show` and `hide` in the same request. The API answers `400`.
</Callout>

## Fields inside child objects [#fields-inside-child-objects]

Use dot notation for a field inside a child object. For an array such as `items`, the path applies to every item.

```bash
# Only the total and each item's name and price
curl "https://api.comecero.com/api/v1/carts/0091307952465CafhFSTa1?show=total,items.name,items.price" \
  -H "Authorization: Bearer $COMECERO_TEST_TOKEN"
```

- With `show`, naming a child field keeps its parent, so `show=customer.email` returns `customer` with only `email` in it.
- With `show`, naming a child object without any of its fields (`show=customer`) returns the whole child object.
- With `hide`, `hide=items.date_created` removes `date_created` from every item and keeps the rest.

## With expand [#with-expand]

`show` and `hide` also reach into [expanded objects](/docs/basic-concepts/expanding-objects). This returns each item's product, without its images:

```bash title="Request"
curl "https://api.comecero.com/api/v1/carts/0091307952465CafhFSTa1?expand=items.product&hide=items.product.images" \
  -H "Authorization: Bearer $COMECERO_TEST_TOKEN"
```

## In lists [#in-lists]

On a list, the fields you name apply to each item in `data`. The paging fields such as `next_page_url` are kept.

```bash title="Request"
curl "https://api.comecero.com/api/v1/orders?show=order_id,total,currency" \
  -H "Authorization: Bearer $COMECERO_TEST_TOKEN"
```

When you also send `formatted=true`, the `formatted` object follows the same choice: it holds only the formatted versions of the fields you show (see [Localized formatting](/docs/basic-concepts/localized-formatting)).

A field name that does not exist is ignored, not refused, so check the spelling if a field is missing.

## Next steps [#next-steps]

<Cards>
  <Card title="Expanding objects" href="/docs/basic-concepts/expanding-objects" />
  <Card title="Partial updates" href="/docs/basic-concepts/partial-updates" />
</Cards>
