# Intercepting (and modifying) API calls to IDmission's backend with onBeforeSubmit



## Scope and provenance

- Product: web
- Status: Imported reference snapshot. Import date is not a verification date or guarantee of current release support.
- SDK version: Not declared for this page. Versions in examples must not be assumed current.
- Environment: Page-specific. Confirm the environment host, credentials, and service configuration; do not infer them from another product.
- Source: https://websdk2docs.idmission.com/other/customizing-api-calls
- Imported at: 2026-10-21T17:27:01.149Z
- Canonical page: https://docs.idmission.com/web/other/customizing-api-calls
- Agent index: https://docs.idmission.com/llms.txt

---

<a id="intercepting-and-modifying-api-calls-to-idmissions-backend-with-onbeforesubmit"></a>

### Intercepting (and modifying) API calls to IDmission's backend with `onBeforeSubmit`

Each customer flow documented above includes an optional `onBeforeSubmit` prop, which bears the type signature `(request: SubmissionRequest) => Promise<SubmissionRequest>`. This can be useful if you would like to include some custom functionality that interrupts the WebSDK's outgoing request to IDmission's servers, allowing you a chance to modify the request before it is dispatched.

To delay the submission until some async condition has been met by your application:

```js
onBeforeSubmit: () => new Promise((resolve) => {
  // do whatever you want in here, websdk will delay submission until you call:
  resolve()
})
```

Calling `resolve()` without an argument as shown above will result in no modification being made to the request that will be sent to IDmission's servers.

To alter the submission request before it goes out:

```js
onBeforeSubmit: (req) => new Promise((resolve) => {
  req.myRandomExtraThing = '123'
  resolve(req)
})
```

Note that you will receive the request as a parameter to `onBeforeSubmit`, and must `resolve` with the altered version in order for your changes to be committed.

If the promise is rejected or an error is thrown, that rejection value or error will be printed to the logs and the request will be not be sent. The `onRequestFailure` hook will be fired with the error that came from your code.
