> For the complete documentation index, see [llms.txt](https://developers.stub.africa/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://developers.stub.africa/api-documentation/pull-data.md).

# Pull data

### Pull businesses linked to email

Check businesses linked to an email account.

{% openapi src="<https://openapi.gitbook.com/o/S24dgdsS19GA0VIrLmgN/spec/stubapi-corrected.json>" path="/api/pull/business" method="post" %}
<https://openapi.gitbook.com/o/S24dgdsS19GA0VIrLmgN/spec/stubapi-corrected.json>
{% endopenapi %}

### Asynchronously pull insights

The financial insights for the specified business will be returned to the specified webhook.

{% openapi src="<https://openapi.gitbook.com/o/S24dgdsS19GA0VIrLmgN/spec/stubapi-corrected.json>" path="/api/pull/insights" method="post" expanded="true" %}
<https://openapi.gitbook.com/o/S24dgdsS19GA0VIrLmgN/spec/stubapi-corrected.json>
{% endopenapi %}

***

### Asynchronously pull expense

The expenses for the specified business will be returned to the specified webhook.

{% openapi src="<https://openapi.gitbook.com/o/S24dgdsS19GA0VIrLmgN/spec/stubapi-corrected.json>" path="/api/pull/expenses" method="post" expanded="true" %}
<https://openapi.gitbook.com/o/S24dgdsS19GA0VIrLmgN/spec/stubapi-corrected.json>
{% endopenapi %}

### Asynchronously pull income

Income for the specified business will be returned to the specified webhook.

{% openapi src="<https://openapi.gitbook.com/o/S24dgdsS19GA0VIrLmgN/spec/stubapi-corrected.json>" path="/api/pull/income" method="post" expanded="true" %}
<https://openapi.gitbook.com/o/S24dgdsS19GA0VIrLmgN/spec/stubapi-corrected.json>
{% endopenapi %}

***

### Trigger bank sync

Sync bank accounts for the specified business if available.

{% openapi src="<https://openapi.gitbook.com/o/S24dgdsS19GA0VIrLmgN/spec/stubapi-corrected.json>" path="/api/pull/bank-feed" method="post" expanded="true" %}
<https://openapi.gitbook.com/o/S24dgdsS19GA0VIrLmgN/spec/stubapi-corrected.json>
{% endopenapi %}

***

### Generate upload s3 URL

It may be preferable to upload settlements via a JSON file. This endpoint generates a presigned s3 URL that allows the user to upload the file to a secure s3 bucket.

The JSON file is expected to contain an array of settlements.

```json
[
  {
   "settlement": {...},
   "income": [{...}], 
   "expenses": [{...}]
  }
]
```

For more information see [Asynchronously push settlement data](/api-documentation/push-data.md#asynchronously-push-settlement-data).

This endpoint returns data in this form:

```json
{
  "error": false,
  "path": "<filepath-for-push-settlement>",
  "url": "<s3-upload-url>"
}
```

When you've retrieved the URL and created the JSON file you upload them using a PUT request to AWS s3

```bash
curl -X PUT \
-T filename.json \
-H "Content-Type: application/octet-stream" \
'<s3-upload-url>'
```

{% openapi src="<https://openapi.gitbook.com/o/S24dgdsS19GA0VIrLmgN/spec/stubapi-corrected.json>" path="/api/pull/s3-upload-url" method="post" expanded="true" %}
<https://openapi.gitbook.com/o/S24dgdsS19GA0VIrLmgN/spec/stubapi-corrected.json>
{% endopenapi %}
