> For the complete documentation index, see [llms.txt](https://legacy-docs.usesmileid.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://legacy-docs.usesmileid.com/further-reading/faqs/how-do-i-setup-a-callback.md).

# How do I set up a callback?

{% hint style="info" %}
The size of the payload sent to your callback can vary. We recommend your callback should accept payloads up to 1.5MB in size.
{% endhint %}

The callback mechanism allows for asynchronous job requests and responses. While the job\_status API can be polled to get a result, a better method is to set up a callback url and let the system **POST** a JSON response. This is especially recommended for SDK implementations because the result will go directly back to your server and avoid client side security issues.

{% hint style="info" %}
Jobs can take different times to process. While most jobs take only a few seconds, jobs that require human review can take longer. The callback mechanism allows you to make a job request and receive all results without polling.
{% endhint %}

{% hint style="info" %}
The partner params structure is passed back with every callback. We suggest using the *job\_id* parameter to connect job requests and job results. You can also set optional keys in the partner params structure to aid in this connection.
{% endhint %}

## Setting your callback url

Most of the job requests you submit are processed asynchronously, which means results are not immediately available. We require callbacks so we can post json responses when the results of your job are available. There are two main callback urls you can set for your requests - a *default callback* which we will post results to by default or you can *pass a callback url in each job request* you make, in this case responses will be posted to the job level callback.

{% hint style="warning" %}
We require you to set a callback url each for Sandbox and Production.
{% endhint %}

### Setting the Default Callback URL

There are two ways of setting default callback urls:

#### A. Partner Portal

![Setting default Callback URL in Portal](/files/vzpItnAESAQYiIjX38Kz)

Follow the steps below to set your default callback url in the partner portal

1. Login into the [portal](https://portal.usesmileid.com/login)
2. Switch to the Developer Tools page from the menu
3. Click [Add callback URL](https://portal.usesmileid.com/security-settings) in the Callback URLs Section
4. Input your callback url (take note of the active environment)
5. Click on actions button and select the `mark as default` option

{% hint style="warning" %}
You can add multiple call back URLs but you can only have one default.
{% endhint %}

#### B. Server to Server Libraries

You can also set default callback in any of our server-to-server libraries, you can achieve this by setting the `default_callback` parameter in the initialisation of the `WebAPI` class of the server-to-server library you are using.

### Setting the per Job Callback URL

{% hint style="warning" %}
Setting a callback on a job request will override the callback URL for that job only
{% endhint %}

Setting a job level callback url varies based on your integration option of choice.

#### A. Rest API

For products that support callback urls, just set your url as string in the `callback_url` key of your request body.

#### B. Server to Server Libraries

Set the `optional_callback` parameter in the `options` structure passed to the `submit_job` function of the `WebAPI` class.

#### C. Mobile SDKs

You can set the per job callback url in the mobile SDKs by using the method `<SIDNetData>.setCallBackUrl(<Your_Callback_URL>)`.

## Whitelisting

To be sure the requests being received are, in fact, from Smile ID there are 2 ways this can be done

1. Verifying the incoming signature parameter in the request body of the result
2. Whitelisting our originating IP addresses (see below):

{% hint style="warning" %}
For Production callbacks:

`13.51.0.119`

`34.240.137.52`

`51.20.27.3`

`52.213.46.74`
{% endhint %}

{% hint style="warning" %}
For Sandbox callbacks:

`13.48.228.158`

`16.170.104.93`

`54.246.37.255`

`99.81.237.141`
{% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://legacy-docs.usesmileid.com/further-reading/faqs/how-do-i-setup-a-callback.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
