<!-- Source: https://docs.squirro.com/en/latest/api/squirro.lib.nlp.steps.external.EndpointStep.html -->
# EndpointStep

**`class EndpointStep(config)`**

Bases: [`BatchedStep`](../technical/libnlp/steps/standard.md#squirro.lib.nlp.steps.batched_step.BatchedStep)

Step that uses an external API endpoint.

It sends a batch of [`Document`](../technical/libnlp/base.md#squirro.lib.nlp.document.Document) in the shape of {“docs”:LIST_OF_DOCS, “fields”:LIST_OF_FIELDS}
to the endpoint and returns the received batch of [`Document`](../technical/libnlp/base.md#squirro.lib.nlp.document.Document)

Parameters

- `type` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)) – endpoint
- `fields` ([`list`](https://docs.python.org/3.11/library/stdtypes.html#list)) – list of relevant fields
- `process_endpoint` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)) – URL of batched process endpoint
- `train_endpoint` ([`str`](https://docs.python.org/3.11/library/stdtypes.html#str)) – URL of batched train endpoint

**Example**

```json
{
    "name": "endpoint",
    "step": "endpoint",
    "type": "endpoint",
    "fields": ["title","body"],
    "process_endpoint": "https://localhost:<PORT>/process",
    "train_endpoint": "https://localhost:<PORT>/train"
}
```

Methods SummaryMethods Documentation

**`process_batch(batch)`**

Process a batch of documents. If not defined will default to using
self.process_doc for each document in the batch.

Parameters

`batch` ([`list`](https://docs.python.org/3.11/library/stdtypes.html#list)`(`[`Document`](../technical/libnlp/base.md#squirro.lib.nlp.document.Document)`)`) – List of documents

Returns

List of processed documents

Return type

[list](https://docs.python.org/3.11/library/stdtypes.html#list)([Document](../technical/libnlp/base.md#squirro.lib.nlp.document.Document))

**`train_batch(batch)`**

Train on a batch of documents

Parameters

`batch` ([`list`](https://docs.python.org/3.11/library/stdtypes.html#list)`(`[`Document`](../technical/libnlp/base.md#squirro.lib.nlp.document.Document)`)`) – List of documents
