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

# Call internal service endpoints in a Workflow

export const RecipeBadges = ({badges = []}) => {
  const map = {
    "recipe": {
      label: "Recipe",
      color: "#A86400"
    },
    "ai-excellence": {
      label: "AI excellence",
      color: "#653EE8"
    },
    "production-readiness": {
      label: "Production readiness",
      color: "#226686"
    },
    "incident-mgmt": {
      label: "Incident management",
      color: "#86198F"
    },
    "migrations": {
      label: "Migrations",
      color: "#0E7C66"
    },
    "compliance": {
      label: "Compliance",
      color: "#475569"
    },
    "dora": {
      label: "DORA metrics",
      color: "#1D4ED8"
    },
    "security": {
      label: "Security",
      color: "#B42318"
    },
    "operational-readiness": {
      label: "Operational readiness",
      color: "#B54708"
    },
    "dev-onboarding": {
      label: "Developer onboarding",
      color: "#C11574"
    }
  };
  const items = badges.map(key => map[key]).filter(Boolean);
  if (items.length === 0) return null;
  return <div className="not-prose flex flex-wrap gap-2 mb-6">
      {items.map(b => <span key={b.label} className="rounded-lg px-2 py-1 text-xs font-medium" style={{
    backgroundColor: b.color,
    color: b.textColor || "#FFFFFF"
  }}>
          {b.label}
        </span>)}
    </div>;
};

<RecipeBadges badges={["recipe", "operational-readiness"]} />

Your organization may have services that are not publicly accessible but contain information that would be useful to manage in Cortex. You can use an [HTTP action in a Workflow](/streamline/workflows/create) and [Cortex's Axon Relay](/ingesting-data-into-cortex/integrations/axon-relay) to call internal services without exposing the service or authentication outside of your firewall.

### How to call internal service endpoints in a Workflow <a href="#how-to-call-internal-service-endpoints-in-a-workflow" id="how-to-call-internal-service-endpoints-in-a-workflow" />

#### Prerequisites <a href="#prerequisites" id="prerequisites" />

Before getting started, you should have already [set up the Cortex Axon agent](/ingesting-data-into-cortex/integrations/axon-relay) and [set your Cortex API token in the .env file](/ingesting-data-into-cortex/integrations/axon-relay#step-1-2-create-a-env-file-and-a-docker-compose-yml-file).

**Considerations**

* This guide describes using a Docker compose file, but note that Axon Relay can be run in Kuberenetes or other container systems.
* As an example throughout this guide, assume a service in the network has the following endpoint:

`GET http://cities.internal.my-company.com/api/cities/s => ["Seattle", "Sydney", "Shanghai" ...]`

#### Step 1: Create request forwarding configuration <a href="#step-1-create-request-forwarding-configuration" id="step-1-create-request-forwarding-configuration" />

* Create a file that defines how requests are routed.
  * The example below permits any requests, but note that the `method` and `path` can be narrowed to allow access to specific endpoints:

```
{
   "private": [
     {
       "method": "any", 
       "path": "/*",   
       "origin": "http://cities.internal.my-company.com"
     }
   ]
}

```

#### Step 2: Configure Axon Docker container <a href="#step-2-configure-axon-docker-container" id="step-2-configure-axon-docker-container" />

1. Create an accept file (in this example, `docker-compose.yml`) that defines how the container will route traffic and which routes are allowed.
   * For production employments, two replicas should be specified. The example below can be used to test the system.

```
services:
 relay-cities:
   image: ghcr.io/cortexapps/cortex-axon-agent:latest
   environment:
     HOSTNAME: relay-cities-${HOSTNAME:-local}
     CORTEX_API_TOKEN: $CORTEX_API_TOKEN
   volumes:
     - "./accept.cities.json:/app/accept.json"
   command: [
     "relay",
     "-a", "axon-relay-cities", # this can be any unique value
     "-f", "/app/accept.json",
   ]
```

2. Start the container, which will register it with Cortex: Run the command `docker compose up`.

#### Step 3: Create the Workflow in Cortex <a href="#step-3-create-the-workflow-in-cortex" id="step-3-create-the-workflow-in-cortex" />

1. Follow the [steps to start creating a Workflow](/streamline/workflows/create#creating-a-workflow) and [configure its basic details](/streamline/workflows/create#creating-a-workflow).
2. Add an HTTP request block to your Workflow. Configure the block:
   * **Block name**: Enter a human readable name.
   * **Slug**: Enter a unique identifier for the block.
   * **HTTP method**: GET
   * **URL**: Enter a URL in the following format: `http://[your-configuration-alias]@relay-proxy.cortex.io[/desired/url/path]`
     * For the example from this guide, it would be `http://axon-relay-cities@relay-proxy.cortex.io/api/cities/s`
   * **Headers**: For more information on headers, see the [HTTP request block documentation](/streamline/workflows/create).
3. After saving your changes, run the Workflow.
   * Click **Run** at the top of the Workflow.
   * Learn more about Workflow runs in [Running a Workflow](/streamline/workflows/run).

After running the Workflow, check its **Outputs** for the "Call cities endpoint" data:

<img src="https://mintcdn.com/cortex-290c0c42/qRY2zZcIyXqFVeCq/guides/images/cities-endpoint.jpg?fit=max&auto=format&n=qRY2zZcIyXqFVeCq&q=85&s=efea92adc630a9eb7d95ddb98241049d" alt="The 'call cities endpoint' data appears in the Output of the Workflow." width="716" height="442" data-path="guides/images/cities-endpoint.jpg" />


## Related topics

- [Calling internal service endpoints via plugin proxy](/streamline/plugins/calling-internal-service-endpoints-via-plugin-proxy.md)
- [Workflows](/guides/product-areas/workflows.md)
- [Internally hosted integrations](/ingesting-data-into-cortex/integrations/axon-relay.md)
