> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rwsintegration.com/llms.txt
> Use this file to discover all available pages before exploring further.

# API

> Configure authentication methods to connect RWS Integration to REST APIs

Connections define how RWS Integration authenticates with external APIs and services. Each connection type handles a different authentication pattern, from simple API keys to OAuth 2.0 flows.

Choose your connection type based on how the target API expects authentication:

| Connection Type                         | Use When                                                    |
| --------------------------------------- | ----------------------------------------------------------- |
| [No authentication](#no-authentication) | API doesn't require any credentials                         |
| [Simple](#simple)                       | API requires headers only (API keys, basic auth)            |
| [OAuth 2.0](#oauth-2-0)                 | API uses token-based authentication with client credentials |
| [Session](#session)                     | API uses cookie-based session authentication                |
| [Google/GCP](#googlegcp)                | Connecting to Google Cloud Platform services                |

<CardGroup cols={2}>
  <Card title="No authentication" icon="lock-open" href="#no-authentication">
    No credentials needed
  </Card>

  <Card title="Simple" icon="key" href="#simple">
    Headers and query params only
  </Card>

  <Card title="OAuth 2.0" icon="shield-halved" href="#oauth-2-0">
    Token-based authentication
  </Card>

  <Card title="Session" icon="cookie" href="#session">
    Cookie-based sessions
  </Card>

  <Card title="Google/GCP" icon="google" href="#googlegcp">
    Service account auth
  </Card>
</CardGroup>

## No authentication

The simplest option, and the one selected by default when you create a new connection. Use it when the API doesn't ask for any credentials. Requests are sent as-is, with no extra headers or parameters.

### When to use

* Public APIs that anyone can call
* Test and sandbox endpoints
* Destinations like webhook.site that accept any request

### Configuration

Nothing to configure: when **No authentication** is selected, the header and query parameter fields are hidden.

<Note>
  Connections that were previously saved as **Simple** with no parameters now show up as **No authentication** when you edit them. It's the same behavior, under a clearer name.

  If you type parameters under **Simple** and then switch to **No authentication**, the values stay in the form (switching back to Simple restores them), but they are not saved while No authentication is selected.
</Note>

## Simple

Basic connection type for APIs that authenticate via HTTP headers. Use this when the API requires a static API key, basic authentication, or any header-based credential that doesn't expire or refresh.

### When to use

* APIs with static API keys
* Services using `Authorization: Basic` headers
* Any API where credentials are passed directly in headers

### Configuration

Simple connections require only the headers that the target API expects. No additional configuration is needed.

**Required fields:**

| Field        | Description                                        |
| ------------ | -------------------------------------------------- |
| Headers      | Key-value pairs to include in every request        |
| Query Params | Key-value pairs to include as URL query parameters |

## OAuth 2.0

Connection type for APIs that use OAuth 2.0 authentication. RWS Integration requests an access token from the OAuth server and includes it in subsequent API calls.

### When to use

* Enterprise APIs (Salesforce, HubSpot, Microsoft)
* APIs requiring client credentials flow
* Services where tokens expire and need refresh
* Any API that issues Bearer tokens

### Configuration

OAuth 2.0 connections require details about the token endpoint, how to extract the token from the response, and how the token should be sent in subsequent requests.

**Required fields:**

| Field                  | Description                                                                                                                                                                                                            |
| ---------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| Token Type             | How the token is sent: `Bearer` (Authorization header) or `Api Token` (custom header)                                                                                                                                  |
| Header Attribute Name  | The header name used to send the token in subsequent requests. For `Bearer` type, this is automatically set to `Authorization`. For `Api Token` type, specify the custom header name (e.g., `X-Auth-Token`, `Api-Key`) |
| Method                 | HTTP method for the token request (typically `POST`)                                                                                                                                                                   |
| Base URL               | Base URL of the OAuth server                                                                                                                                                                                           |
| Path                   | Endpoint path for token requests (e.g., `/oauth/token`)                                                                                                                                                                |
| Token Path in Response | JSON path to extract the token from the response body                                                                                                                                                                  |

### Token Type and Header Attribute Name

The **Token Type** determines the format used when sending the token, while the **Header Attribute Name** specifies which header carries the token:

| Token Type  | Header Attribute Name         | Request Header Sent             |
| ----------- | ----------------------------- | ------------------------------- |
| `Bearer`    | `Authorization` (automatic)   | `Authorization: Bearer {token}` |
| `Api Token` | Custom (e.g., `X-Auth-Token`) | `X-Auth-Token: {token}`         |
| `Api Token` | Custom (e.g., `Api-Key`)      | `Api-Key: {token}`              |

<Tip>
  **Token Path examples:**

  The token path tells RWS Integration where to find the access token in the OAuth server's response.

  | Response Structure                                 | Token Path                    |
  | -------------------------------------------------- | ----------------------------- |
  | `{"access_token": "xyz"}`                          | `access_token`                |
  | `{"data": {"token": "xyz"}}`                       | `data.token`                  |
  | `{"response": {"credentials": {"bearer": "xyz"}}}` | `response.credentials.bearer` |
</Tip>

## Session

Connection type for APIs that use session-based authentication via cookies. RWS Integration performs a login request, captures the `Set-Cookie` headers, and maintains the session for subsequent requests.

### When to use

* Legacy systems with session-based authentication
* Internal APIs that require cookie authentication
* Web services with login flows
* Systems that don't support modern token-based auth

### Configuration

Session connections require the login endpoint details. RWS Integration automatically handles cookie capture and session management.

**Required fields:**

| Field    | Description                                          |
| -------- | ---------------------------------------------------- |
| Method   | HTTP method for the login request (typically `POST`) |
| Base URL | Base URL of the authentication server                |
| Path     | Login endpoint path (e.g., `/api/login`)             |

<Info>
  RWS Integration captures all `Set-Cookie` headers from the login response and includes them automatically in all subsequent requests to the same base URL.
</Info>

## Google/GCP

Connection type for Google Cloud Platform services. Uses service account authentication to access GCP APIs like Google Sheets, BigQuery, Cloud Storage, and others.

### When to use

* Google Sheets integration
* BigQuery data extraction or loading
* Google Drive file operations
* Cloud Storage (GCS) access
* Any GCP API service

### Configuration

GCP connections require a service account with appropriate permissions and the OAuth scopes for the services you need to access.

**Required fields:**

| Field                         | Description                                               |
| ----------------------------- | --------------------------------------------------------- |
| Google API Scopes             | OAuth scopes required for the GCP services (one per line) |
| Google Service Account (JSON) | Full JSON key file content from your GCP service account  |

### Common scopes

| Service                    | Scope                                                   |
| -------------------------- | ------------------------------------------------------- |
| Google Sheets (read/write) | `https://www.googleapis.com/auth/spreadsheets`          |
| Google Sheets (read only)  | `https://www.googleapis.com/auth/spreadsheets.readonly` |
| Google Drive               | `https://www.googleapis.com/auth/drive`                 |
| BigQuery                   | `https://www.googleapis.com/auth/bigquery`              |
| Cloud Storage              | `https://www.googleapis.com/auth/devstorage.read_write` |

### Permissions

<Warning>
  The service account must have appropriate IAM permissions for the resources you want to access. For Google Sheets, share the spreadsheet directly with the service account email address (`client_email` in the JSON).
</Warning>

## Next steps

<CardGroup cols={2}>
  <Card title="Pagination" icon="arrows-rotate" href="/en/features/extract/pagination">
    Handle different API pagination patterns
  </Card>

  <Card title="Business Rules" icon="code" href="/en/features/business-rules/overview">
    Transform data with JavaScript
  </Card>
</CardGroup>
