# ApiResponse - Liquid Object Reference

Source: https://support.storeconnect.com/articles/api-response-liquid-object-reference · Last modified 21 August 2026

## Description

An `ApiResponse` holds the result of an outbound HTTP request made with the [api tag](api-tag-reference). Inside an `{% api %}...{% endapi %}` block that specifies a `url`, the response is exposed as the `response` object once the request completes, so you can branch on the status code and read the returned data.

The `response` object is only populated for **synchronous** requests (`async: false`). With `async: true` the request is dispatched fire-and-forget and no response is returned to the template.

## Attributes

| Attribute | Type | Description |
|-----------|------|-------------|
| `status` | Number | The HTTP status code of the response (e.g. `200`, `404`, `500`). It compares numerically, so `response.status >= 200 and response.status < 300` tests for success. |
| `body` | Map | The HTTP response body. When the endpoint returns JSON it is parsed automatically, so nested fields are reachable directly (`response.body.access_token`, `response.body.data`). Use the [serialize filter](serialize-filter-reference) to turn a Map or List back into a JSON string for storage or output. |
| `headers` | Map | The HTTP response headers, keyed by header name. |

## Examples

### Read a successful JSON response


```liquid

{% liquid
  new Map headers = '{ "Accept": "application/json" }'
  assign result = ''
  api url: 'https://api.example.com/v1/status', method: 'GET', headers: headers, async: false
    if response.status >= 200 and response.status < 300
      assign result = response.body.message
    endif
  endapi
%}
{{ result }}
```


### Handle an error status

Always check `status` before trusting `body`, and capture the raw body when a call fails so the error is visible while developing:


```liquid

{% liquid
  api url: 'https://api.example.com/v1/orders', method: 'GET', headers: headers, async: false
    if response.status >= 200 and response.status < 300
      assign orders = response.body.orders
    else
      assign error = response.body | serialize
      debug status: response.status, error: error
    endif
  endapi
%}
```


### Read a response header


```liquid

{% api url: 'https://api.example.com/v1/status', method: 'GET', async: false %}
  {% assign request_id = response.headers['x-request-id'] %}
{% endapi %}
```


See the [api tag reference](api-tag-reference) for how to issue the request, set headers, and send a request body.

---

## Follow StoreConnect

- [Email Newsletter](https://getstoreconnect.com/c/lp-newsletter)
- [LinkedIn Newsletter](https://www.linkedin.com/build-relation/newsletter-follow?entityUrn=7444956928444862464)
- [YouTube](https://www.youtube.com/channel/UCngKdP2x8l1wcbAKW3tvU8g)
- [LinkedIn](https://www.linkedin.com/company/storeconnect)
- [X / Twitter](https://x.com/storeconnecthq)

## Popular Links

- [Partners](https://getstoreconnect.com/partners)
- [News](https://getstoreconnect.com/articles/news)
- [Events](https://getstoreconnect.com/articles/events)
- [Feature Comparison](https://getstoreconnect.com/how-we-compare)
- [Download a free trial](https://appexchange.salesforce.com/appxListingDetail?listingId=a0N3A00000FMkeKUAT)
- [Book a Demo](https://getstoreconnect.com/contact)

## Documentation

- [Help documentation](https://support.storeconnect.com/help-documentation)
- [AI agents](https://support.storeconnect.com/ai)
- [Videos & tutorials](https://support.storeconnect.com/videos-tutorials)
- [Developer reference](https://support.storeconnect.com/developer-reference)
- [Release notes](https://support.storeconnect.com/release-notes)
- [Troubleshooting](https://support.storeconnect.com/troubleshooting)
- [Trust Center](https://trust.getstoreconnect.com/)
- [Status Page](https://status.storeconnect.com/)

## Contact

- info@getstoreconnect.com
- US +1 415 745 3230
- AUS +61 2 8365 2308

100 S Ashley Dr, Suite 600-2461
Tampa FL 33602-600 USA

Level 22, Sydney Place
180 George Street
Sydney, NSW, 2000, AUS

---

StoreConnect Support — https://support.storeconnect.com/articles/api-response-liquid-object-reference