# JSON

JSON is a universal data format used by thousands of APIs and web services. With Coupler.io's JSON source, you can connect to any REST API endpoint that returns JSON data—no coding or special tools required. Whether you're pulling data from a custom API, a SaaS platform's REST endpoint, or your own server, JSON gives you complete flexibility.

## Why connect to Coupler.io?

* **Work with any REST API** — Connect to APIs that don't have a pre-built Coupler.io connector, or use multiple endpoints from the same service
* **No coding required** — Configure HTTP methods, headers, query parameters, and request bodies through a simple form
* **Support for all HTTP methods** — Use GET, POST, PUT, PATCH, or DELETE depending on your API's requirements
* **Flexible data extraction** — Target specific nested objects with path expressions, select specific columns, and handle complex JSON structures
* **Send data anywhere** — Deliver your JSON data to Google Sheets, Excel, BigQuery, Looker Studio, or AI destinations like Claude, ChatGPT, and Gemini

## Prerequisites

* A REST API endpoint that returns JSON data (public URL or with authentication)
* API authentication credentials if your endpoint requires them (API keys, OAuth tokens, etc.)
* Basic understanding of your API's requirements (HTTP method, headers, parameters)

## Quick start

{% hint style="success" %}
Before you start, gather your API documentation. You'll need the endpoint URL and any authentication details (headers, API keys, or OAuth tokens). Have your API docs handy so you can reference the exact HTTP method and any required parameters.
{% endhint %}

## How to connect

{% stepper %}
{% step %}
**Create a new data flow** and select **JSON** as your source.
{% endstep %}

{% step %}
**Enter the JSON URL** — Paste the REST API endpoint URL where you want to fetch data from (e.g., `https://api.example.com/v1/users`).
{% endstep %}

{% step %}
**Select the HTTP method** — Choose the method your API requires: GET (most common), POST, PUT, PATCH, or DELETE. Check your API documentation if you're unsure.
{% endstep %}

{% step %}
**Add authentication headers** (if needed) — If your API requires authentication, add headers like `Authorization: Bearer YOUR_TOKEN` or `X-API-Key: YOUR_KEY` in the **Request headers** field. Format each header on a new line as `HeaderName: HeaderValue`.
{% endstep %}

{% step %}
**Add URL query parameters** (if needed) — If your API requires query parameters like `?filter=active&limit=100`, add them in the **URL query parameters** field. Format as `key=value` pairs, one per line.
{% endstep %}

{% step %}
**Add a request body** (if needed) — If you're using POST, PUT, or PATCH, and your API requires a body, add it in YAML format. Convert JSON examples from your API docs to YAML using a tool like [JSON2YAML](https://www.json2yaml.com/). For example: `customer_id: 1` and `customer_email: email@example.com` on separate lines.
{% endstep %}

{% step %}
**Set the path** (optional) — If your JSON response has nested objects and you only want data from a specific part, use dot notation (e.g., `data.users` or `results.items`). Leave blank to import all data from the root level.
{% endstep %}

{% step %}
**Select columns** (optional) — By default, all columns are imported. To import only specific columns, list their names separated by commas (e.g., `id,name,email,created_at`).
{% endstep %}

{% step %}
**Choose your destination** — Select where you want the data to go: Google Sheets, Excel, BigQuery, Looker Studio, or an AI destination like Claude or ChatGPT.
{% endstep %}

{% step %}
**Run the data flow** — Click **Run** to execute the data flow and test the connection. A successful run is required before you can schedule regular updates.
{% endstep %}
{% endstepper %}

## Common use cases

JSON works with any REST API. Here are typical scenarios:

| Use case                               | HTTP method               | Authentication                    |
| -------------------------------------- | ------------------------- | --------------------------------- |
| Fetch user or product data             | GET                       | API key or OAuth token in headers |
| Submit webhook data or custom requests | POST                      | API key or OAuth token            |
| Update records from an external system | PUT / PATCH               | API key or OAuth token            |
| Sync data from a custom internal API   | GET / POST                | Bearer token or custom headers    |
| Pull data from multiple API endpoints  | GET (multiple data flows) | API key or OAuth token            |

{% hint style="info" %}
If you're pulling data from multiple endpoints or combining data from different API calls, create separate data flows for each endpoint and use **Append** or **Join** transformations to combine them in your destination.
{% endhint %}
