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

# Component Call

> Run a reusable component with inputs and map its outputs back

The **Component Call** node runs a [component](https://docs.cloudcruise.com/concepts/workflow-components.md): a group of nodes defined once and called from any workflow. It passes values in as inputs and writes the component's outputs to places you choose. The component runs in its own scope and sees only the inputs you pass.

## Parameters

| Parameter | Type | Required | Description |
| - | - | - | - |
| `component` | object | Yes | Which component to run: `type`, `ref`, and optionally `version` |
| `input_mappings` | object | Yes | Maps each input name to a value: a literal, or a string with `{{…}}` expressions. Use `{}` when the component has no inputs |
| `output_mappings` | object | No | Maps each output name to the context path it is written to. Defaults to `context.outputs.<name>` |
| `allowed_components` | array | When `ref` is dynamic | The components a dynamic `ref` may resolve to |

### `component`

| Field | Description |
| - | - |
| `type` | `local` for a component stored on this workflow in `local_components`, `global` for a workspace component listed in `component_imports` |
| `ref` | The component's id |
| `version` | A version number, or `"latest"`. Used for `global` only; defaults to `"latest"` |

A bare `{{expr}}` in `input_mappings` keeps its type, so an array stays an array.

## Examples

### Call a local component with a credential

```json theme={null}
{
  "id": "69719160-893b-412f-ad7c-0f9192a75698",
  "name": "Login",
  "action": "COMPONENT_CALL",
  "parameters": {
    "component": { "type": "local", "ref": "3a09b98b-0170-463b-8ccc-d7d05c961ebf" },
    "input_mappings": { "USER": "USER" },
    "output_mappings": {}
  }
}
```

`USER` is a credential input, so its value is the vault alias `USER`.

### Call a workspace component pinned to a version

```json theme={null}
{
  "id": "2f6d1c0e-8b7a-4d3c-9e5f-0a1b2c3d4e5f",
  "name": "Search the site",
  "action": "COMPONENT_CALL",
  "parameters": {
    "component": { "type": "global", "ref": "6c1e0f2a-3b4d-4e5f-8a9b-0c1d2e3f4a5b", "version": 3 },
    "input_mappings": { "query": "{{context.inputs.search_term}}" },
    "output_mappings": { "result_url": "context.search.url" }
  }
}
```

The workflow lists the workspace component in `component_imports`:

```json theme={null}
"component_imports": [{ "id": "6c1e0f2a-3b4d-4e5f-8a9b-0c1d2e3f4a5b", "version": 3 }]
```

### A local component definition

Local components live in the workflow's `local_components`. A component has a Start, an End, its nodes and edges, and optional `input_schema` and `output_schema`:

```json theme={null}
{
  "id": "d2b9327b-4559-430a-9c6c-9f5427fc842c",
  "name": "extract",
  "nodes": [
    { "id": "3f6d1c2a-7b4e-4a90-8c15-2e9a5d7b1f01", "name": "Start", "action": "START", "parameters": { "url": "" } },
    {
      "id": "4a7e2d3b-8c5f-4b01-9d26-3f0b6e8c2a12",
      "name": "Extract all recipes",
      "action": "EXTRACT_NETWORK",
      "parameters": { "url": "api.example.com/recipes", "api_method": "GET", "extract_data_model": { "type": "object", "properties": { "recipes": { "path": "result.recipes", "type": "array", "items": { "type": "object" }, "selected": true } } } }
    },
    {
      "id": "5b8f3e4c-9d60-4c12-8e37-401c7f9d3b23",
      "name": "Export outputs",
      "action": "TRANSFORM",
      "parameters": { "operations": [{ "type": "SET", "target": "context.component_outputs.recipes", "value": "context.recipes", "optional": true }] }
    },
    { "id": "6c904f5d-0e71-4d23-9f48-512d80ae4c34", "name": "End", "action": "END", "parameters": {} }
  ],
  "edges": { "3f6d1c2a-7b4e-4a90-8c15-2e9a5d7b1f01": { "to": "4a7e2d3b-8c5f-4b01-9d26-3f0b6e8c2a12" }, "4a7e2d3b-8c5f-4b01-9d26-3f0b6e8c2a12": { "to": "5b8f3e4c-9d60-4c12-8e37-401c7f9d3b23" }, "5b8f3e4c-9d60-4c12-8e37-401c7f9d3b23": { "to": "6c904f5d-0e71-4d23-9f48-512d80ae4c34" } },
  "output_schema": { "type": "object", "properties": { "recipes": {} } }
}
```

The call maps the output back: `"output_mappings": { "recipes": "context.recipes" }`.

## Reading inputs and writing outputs

Inside a component:

* Read an input with `{{context.component_inputs.<name>}}`.
* Read a credential input with `{{$lookup(context.inputs, context.component_inputs.<name>).USER_NAME}}`.
* Write an output with a [Transform](https://docs.cloudcruise.com/concepts/workflow-dsl/transform.md) `SET` to `context.component_outputs.<name>`.

Data written anywhere else inside the component stays inside it and is discarded when the call returns.

## Declaring inputs

A component's `input_schema` is a JSON Schema object. Mark an input that takes a vault alias with `"x-cc-type": "credential"`, and list required inputs in `required`:

```json theme={null}
{
  "type": "object",
  "required": ["USER"],
  "properties": {
    "USER": { "type": "string", "x-cc-type": "credential" },
    "query": { "type": "string" }
  }
}
```

## Notes

* A component cannot call itself, directly or through another component.
* A credential cannot be returned as an output or passed as a plain value. A component can only type it into a page.
* A call that cannot run fails with `SERVER-E0007` and a `reason` in the error details.
* A call node has no selector, no `run_if`, and no execution type.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.