> 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.&#x20;

{% openapi src="/files/i28ZJB6aUpE9wfIzCdVJ" path="/api/pull/business" method="post" %}
[stubapi.json](https://4021917470-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnpZtVLrUwNfGfPLu2CDM%2Fuploads%2FeByKftwIoFnhQDFwm1Jq%2Fstubapi.json?alt=media\&token=403ccabe-676a-4f26-92d5-c6516301d7e2)
{% endopenapi %}

### Asynchronously pull insights

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

{% openapi src="/files/i28ZJB6aUpE9wfIzCdVJ" path="/api/pull/insights" method="post" expanded="true" %}
[stubapi.json](https://4021917470-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnpZtVLrUwNfGfPLu2CDM%2Fuploads%2FeByKftwIoFnhQDFwm1Jq%2Fstubapi.json?alt=media\&token=403ccabe-676a-4f26-92d5-c6516301d7e2)
{% endopenapi %}

***

### Asynchronously pull expense

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

{% openapi src="/files/i28ZJB6aUpE9wfIzCdVJ" path="/api/pull/expenses" method="post" expanded="true" %}
[stubapi.json](https://4021917470-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnpZtVLrUwNfGfPLu2CDM%2Fuploads%2FeByKftwIoFnhQDFwm1Jq%2Fstubapi.json?alt=media\&token=403ccabe-676a-4f26-92d5-c6516301d7e2)
{% endopenapi %}

### Asynchronously pull income

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

{% openapi src="/files/i28ZJB6aUpE9wfIzCdVJ" path="/api/pull/income" method="post" expanded="true" %}
[stubapi.json](https://4021917470-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnpZtVLrUwNfGfPLu2CDM%2Fuploads%2FeByKftwIoFnhQDFwm1Jq%2Fstubapi.json?alt=media\&token=403ccabe-676a-4f26-92d5-c6516301d7e2)
{% endopenapi %}

***

### Trigger bank sync

Sync bank accounts for the specified business if available.&#x20;

{% openapi src="/files/i28ZJB6aUpE9wfIzCdVJ" path="/api/pull/bank-feed" method="post" expanded="true" %}
[stubapi.json](https://4021917470-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FnpZtVLrUwNfGfPLu2CDM%2Fuploads%2FeByKftwIoFnhQDFwm1Jq%2Fstubapi.json?alt=media\&token=403ccabe-676a-4f26-92d5-c6516301d7e2)
{% endopenapi %}

***

### Generate upload s3 URL&#x20;

It may be preferable to upload settlementss via a JSON file. This endpoint generates a presigned s3 URL that allows the user to upload the file to a secure s3 bucket.&#x20;

The JSON file is expected to contain an array of settlements.&#x20;

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

For more information see [Push 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>'
```

## POST /api/pull/s3-upload-url

>

```json
{"openapi":"3.1.0","info":{"title":"stub Connect API","version":"1.0.1"},"servers":[{"url":"https://test.connect.stub.africa"}],"security":[{"ApiKeyAuth":[]},{"TokenAuth":[]},{"AppIdAuth":[]},{"OAuth2":["openid"]},{"OpenID":[]}],"components":{"securitySchemes":{"ApiKeyAuth":{"type":"apiKey","in":"header","name":"X-API-Key","description":"API key needed to access the endpoints"},"TokenAuth":{"type":"apiKey","in":"header","name":"X-Token","description":"Token needed to access the endpoints"},"AppIdAuth":{"type":"apiKey","in":"header","name":"X-AppId","description":"AppId needed to access the endpoints"},"OpenID":{"type":"openIdConnect","openIdConnectUrl":"https://auth.stub.africa/.well-known/openid-configuration"}}},"paths":{"/api/pull/s3-upload-url":{"post":{"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"apikey":{"type":"string"},"appid":{"type":"string"},"uid":{"type":"string"},"webhook":{"type":"string"},"signature":{"type":"string"}},"required":["uid"],"additionalProperties":false}},"application/transit+msgpack":{"schema":{"type":"object","properties":{"apikey":{"type":"string"},"appid":{"type":"string"},"uid":{"type":"string"},"webhook":{"type":"string"},"signature":{"type":"string"}},"required":["uid"],"additionalProperties":false}},"application/transit+json":{"schema":{"type":"object","properties":{"apikey":{"type":"string"},"appid":{"type":"string"},"uid":{"type":"string"},"webhook":{"type":"string"},"signature":{"type":"string"}},"required":["uid"],"additionalProperties":false}},"application/edn":{"schema":{"type":"object","properties":{"apikey":{"type":"string"},"appid":{"type":"string"},"uid":{"type":"string"},"webhook":{"type":"string"},"signature":{"type":"string"}},"required":["uid"],"additionalProperties":false}}}},"responses":{"200":{},"400":{},"401":{}},"tags":["Pull data"]}}}}
```
