# Why can't I access the Shopify API during preview mode?

A task is always run in response to an event. However, for several purposes, Mechanic may also run your task with a preview event, *without* performing any of the actions the task generates.

We refer to this as [**preview mode**](/core/tasks/previews.md), and it's used for...

* Showing merchants what actions they can expect the task to perform
* Determining what permissions the task requires in order to run
* Performance-related analysis

Because all of these purposes require *very* fast performance of the task, Mechanic disallows all API requests during preview mode. You can use the `event.preview` variable to make decisions about what should happen during preview mode, like creating [**stub data**](/core/tasks/previews/stub-data.md) that results in the appropriate actions being rendered during preview – a good practice when accounting for [**preview actions**](/core/tasks/previews.md#rendering-preview-actions).


---

# 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://learn.mechanic.dev/faq/why-cant-i-access-the-shopify-api-during-preview-mode.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.
