> For the complete documentation index, see [llms.txt](https://learn.mechanic.dev/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://learn.mechanic.dev/faq/can-i-query-external-apis.md).

# Can I query external APIs?

{% hint style="info" %}
For more general information on third-party APIs, including more options for reading and writing data, see [Working with external APIs](/techniques/working-with-external-apis.md).
{% endhint %}

Mechanic only has first-class API support for Shopify. However, you can use the [HTTP](/core/actions/http.md) action to fetch data from any source that's accessible with an HTTP URL. (APIs that require authentication via query param or header - basic auth, for example - are all supported. APIs that require authentication via OAuth are generally not supported.)

For API keys, passwords, signing keys, and other reusable credentials, store the value as a [shop secret](/platform/globals-and-secrets.md) and reference it from the HTTP action with `secrets.some_key`.

{% hint style="info" %}
Tip: use [Couchdrop's Shared Links](https://couchdrop.io/features/shared-links) to make any file available via a secret URL, from an FTP server or cloud storage provider.
{% endhint %}

For this kind of work, we recommend an execution sequence that looks like this:

1. Use an HTTP action to fire a GET request for your data's URL.
2. Set up your task to respond to mechanic/actions/perform, so you can respond to the GET request's downloaded results.
3. If needed, query the external API again to get additional results (e.g. pagination, extended data).
4. If you expect to use the retrieved data frequently, or across several tasks, consider using the [cache](/platform/cache.md) to store that data for easy re-use.

## Example

* [Demonstration: Fetch an external configuration file](https://usemechanic.com/task/demonstration-fetch-an-external-configuration-file)
* [Demonstration: Query external paginated API](https://tasks.mechanic.dev/demonstration-query-external-paginated-api)


---

# 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 by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://learn.mechanic.dev/faq/can-i-query-external-apis.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
