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

# External Service

> Connect to any REST API.

The External Service task lets you connect your workflow to any REST API. You configure the endpoint, authentication, and request details—then map the response to use in later tasks.

<Note>
  For common services like Google Drive, Slack, or AWS S3, use the [Integrations Task](/tasks/data/integrations) instead—it connects to 3,500+ services from the [Integrations Marketplace](/integrations/overview) and is simpler to set up.
</Note>

## Key Capabilities

<CardGroup cols={2}>
  <Card title="Any REST API" icon="plug">
    Connect to any HTTP endpoint, public or private.
  </Card>

  <Card title="Flexible Authentication" icon="key">
    Support for Bearer tokens, API keys, Basic auth, JWT, or no auth.
  </Card>

  <Card title="Full Control" icon="sliders">
    Configure HTTP method, headers, and request body.
  </Card>

  <Card title="Structured Output" icon="arrow-right-arrow-left">
    Returns request details and service response for downstream processing.
  </Card>
</CardGroup>

## When to Use It

Use External Service when you need to call a custom API:

* Connect to proprietary internal APIs
* Access public APIs without built-in integrations
* Send data to webhook endpoints
* Fetch data from specialized services

## The 5 Configuration Areas

To call an API, you'll configure these five things:

| Area               | What It Does                                                         |
| ------------------ | -------------------------------------------------------------------- |
| **Authentication** | How to authenticate: Bearer token, API key, Basic auth, JWT, or none |
| **Endpoint URL**   | The full URL of the API you're calling                               |
| **HTTP Method**    | The action: GET (fetch data), POST (send data), PUT, DELETE, PATCH   |
| **Content Type**   | Format of your request (usually `application/json`)                  |
| **Request Body**   | The data to send (for POST, PUT, PATCH requests)                     |

### Authentication Options

| Type                 | Use Case                                      |
| -------------------- | --------------------------------------------- |
| **None**             | Public APIs that don't require authentication |
| **Bearer Token**     | APIs using OAuth2 or API tokens               |
| **API Key (Header)** | APIs that accept keys in custom headers       |
| **Basic Auth**       | APIs using username/password authentication   |
| **JWT**              | APIs requiring signed JSON Web Tokens         |

### Output

The External Service task always returns two output variables:

| Output               | Type   | Description                                          |
| -------------------- | ------ | ---------------------------------------------------- |
| **Request Details**  | Object | Contains information about the request that was made |
| **Service Response** | Text   | The raw response from the API                        |

<Note>
  To parse or extract specific fields from the Service Response, add an [Opus Agent](/tasks/agent/opus-agent) task after External Service to process and structure the data.
</Note>

## How to Add External Service

<Steps>
  <Step title="Drop it into your workflow">
    Drag an External Service task into your workflow where you need to call an API.
  </Step>

  <Step title="Enter the endpoint">
    Type the full API URL and select the HTTP method (GET, POST, etc.).
  </Step>

  <Step title="Set up authentication">
    Choose the authentication type and provide credentials if needed. For public APIs, select "None".
  </Step>

  <Step title="Configure the request">
    Add any required headers and configure the request body.
  </Step>

  <Step title="Test it">
    Run a preview to verify the API call works and returns the expected response.
  </Step>

  <Step title="Parse the response">
    Add an Opus Agent task after External Service to extract specific fields from the Service Response.
  </Step>
</Steps>

## Tips for Better Results

<AccordionGroup>
  <Accordion title="Test your API outside Opus first">
    Before configuring External Service:

    * Test the API with a tool like Postman or curl
    * Verify your credentials work
    * Understand the response structure
  </Accordion>

  <Accordion title="Handle errors gracefully">
    APIs can fail for various reasons:

    * Check the response for success/failure status
    * Use a Decision Agent to handle error responses
    * Add fallback paths for when calls fail
  </Accordion>

  <Accordion title="Keep credentials secure">
    Protect your API credentials:

    * Use organization-scoped credentials for shared APIs
    * Never hardcode secrets in request bodies
    * Use variables for sensitive values
  </Accordion>
</AccordionGroup>

## Related

<CardGroup cols={2}>
  <Card title="Import Data" icon="file-import" href="/tasks/data/import-data">
    Pull data from services in the Integration Marketplace.
  </Card>

  <Card title="Export Data" icon="file-export" href="/tasks/data/export-data">
    Send data to services in the Integration Marketplace.
  </Card>

  <Card title="Opus Code" icon="code" href="/tasks/agent/opus-code">
    Write custom code for complex API logic.
  </Card>

  <Card title="Integrations" icon="grid" href="/integrations/overview">
    Explore all available integrations.
  </Card>
</CardGroup>
