# 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"]}}}}
```


---

# 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://developers.stub.africa/api-documentation/pull-data.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.
