# Adding an inbound API connector with a custom payload

## Introduction  <a href="#introduction" id="introduction"></a>

An **Inbound API connecto**r is added like any other Patchworks connector. However, extra steps are required to configure a **custom entity** for the custom payload.

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

To add a **custom entity** for an API connector, you need a JSON file (or JSON content ready to copy/paste), containing the data structure that Patchworks should expect to receive.

Patchworks provide sample structures for products and orders, which you can download and update as required - or define your own from first principles. For services using ‘standard’ connectors, you can define filters to control what source data is processed (and what is ignored). However, filters are not available for API connectors. With custom payloads, you must ensure that your data is pre-filtered before it is sent to Patchworks, so you are only sending data that needs to be processed.

## The steps  <a href="#the-steps" id="the-steps"></a>

Follow the steps below to add a new **Inbound API connector** with a **custom entity**:

**Step 1** \
Select **connectors** from the left-hand navigation menu:

![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FB6JwW16ojJbiMX8qpnPr%2Fadd%20api%20connector%201.png?alt=media\&token=f22c929f-bd1e-4864-a8b1-f7d42c07ca58)

**Step 2** \
Click the **Inbound API connector** tile to access setup options:​

![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FONEdZSnPPIz64srvhyAj%2Fadd%20api%20connector%202.png?alt=media\&token=0f7dd656-772d-4d84-bd29-0254b8b7758f)​

The **Inbound API connector** is available in both **test** and **live** environments, for clients on **Professional** or **Enterprise** plans.

**Step 3** \
Select the **settings** tab:

​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F1d2ACWKMC1EtcvexlQF7%2Fadd%20api%20connector%203.png?alt=media\&token=7f89584f-d78a-4b94-87f7-24b5efce4dad)​

… default entities are displayed for orders and products:

​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FUs5MF85OpjiAnjIhGuLf%2Fadd%20api%20connector%204.png?alt=media\&token=f51e1ce7-9de1-49b1-bd51-34bdd34715f8)​

If required, you can download these sample payloads and adjust them as needed for your custom payload.

**Step 4** \
Click the **add custom entity** button:

**​**![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FbdAusmo9XaK5MZ4EnpnN%2Fadd%20api%20connector%205%20new.png?alt=media\&token=344065db-6f52-4078-aa75-c18586477477)**​**

… the **manage entity** page is displayed:

​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2FLY7X2ap0ysDfXSMnrOb5%2Fadd%20api%20connector%205a.png?alt=media\&token=a66fdc36-3c35-4886-96f3-a95e5679ea46)​

**Step 5** \
Click the **entity type** field:

​![](https://files.gitbook.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FLYNcUBVQwSkOMG6KjZfz%2Fuploads%2F3yFOtaiUI9u2SRxL5uuj%2Fadd%20api%20connector%206.png?alt=media\&token=44df6e9c-2284-4573-ae88-97a4d93b75d3)

...then select a type that best describes data that you will be sending in the custom payload - for example:

![](/files/eeIWkQJL4LLKeHf0fN2m)<br>

**Step 6** \
Enter a name for this entity - this name is displayed for selections later, so ensure that it’s meaningful - for example:

![](/files/9fmx0tibfLKAxEYLAsoj)

**Step 7** \
If your custom payload field data is available in a file, click the **choose file** button to browse for and select this file:

![](/files/UEfAuWNNna6AUf6RNq7w)

… alternatively, you can copy/paste a JSON object - for example:

![](/files/416xwZsCvfLtDC5Q3Vh0)

**Step 8** \
Check **detected fields** to ensure that recognised fields are as expected - for example:

![](/files/QOpx05IVUyX7ZErRHlqI)

… if you’re not satisfied with detected fields, click the **cancel** button, adjust the JSON content and try again - otherwise, click the **save** button to add the custom entity:

![](/files/ur86lAiyHYNecFUZZi0T)

The Inbound API connector is now ready to use in a [Patchworks service](/product-documentation/patchworks-services/working-with-services/adding-a-patchworks-service.md). \
\
However, before exiting from the new connector, it's a good idea to grab the information you'll need later for API authentication -  see [Generating token credentials for API access](/product-documentation/patchworks-services/inbound-api/using-the-inbound-api-connector-with-patchworks-services/generating-token-credentials-for-api-access.md).​


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://doc.wearepatchworks.com/product-documentation/patchworks-services/inbound-api/using-the-inbound-api-connector-with-patchworks-services/adding-an-inbound-api-connector-with-a-custom-payload.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
