Skip to content

Asynchronous Requests

A synchronous endpoint holds the connection open while its integration runs and answers with the integration's response. If the integration takes longer than the endpoint's Request Timeout, the caller receives 408 and never sees the response, although the integration runs on to its end.

An asynchronous endpoint does not make the caller wait. The WebAPI queues the request and answers at once with 202 Accepted and a job id. IMan runs the integration in the background. The caller polls the job until it finishes, then fetches the result. The result is exactly what the synchronous endpoint would have returned. IMan calls each queued request an asynchronous job.

Use an asynchronous endpoint for work that takes longer than a caller can wait, such as a batch of orders posted in one request. Each job starts its own engine process and logs in to its connectors. That costs a few seconds per job. Send a batch as one request rather than one request per record.

The integration is the same in both modes. The endpoint's Response Mode decides which way the WebAPI answers. The limits that apply to every asynchronous endpoint are on the Asynchronous Jobs setup page.

The exchange

  1. Submit the request to the endpoint's route, exactly as for a synchronous endpoint. The WebAPI answers 202 with the job's status URL.
  2. Poll the status URL until the job's status is no longer Queued or Running.
  3. Fetch the result from the job's resultUrl.

At any point the caller can cancel the job with a DELETE to its status URL.

The examples on this page come from an asynchronous endpoint, S300ASYNC on the route sage300orders/bulk, in front of a copy of the Sage 300 order sample. The caller is the sample web user SAGE300, and the body is the order from the POST sample.

The diagram shows a request to the sample's synchronous endpoint, sage300order, above the same request to S300ASYNC.

A sequence diagram with three lanes: the caller, the IMan WebAPI, and the Scheduler with its engine. Synchronous endpoint: the caller sends POST /sage300order and waits while the WebAPI runs the integration itself, until the WebAPI answers 408 Request Timeout at the endpoint's Request Timeout. The integration runs on, and the Scheduler takes no part. Asynchronous endpoint: the WebAPI stores POST /sage300orders/bulk as a Queued job, signals the Scheduler and answers 202 Accepted with Location and Retry-After 5. The Scheduler starts the job and the engine runs the integration. The caller polls GET /asyncjobs/{id} while the job is Queued or Running. Once it reads Completed with a resultUrl, the caller sends GET /asyncjobs/{id}/result, and the WebAPI replays the stored response

Submitting a request

The request is the one the synchronous endpoint takes: the same method, route, headers, authentication and body. A request that IMan refuses before it queues anything fails as it would synchronously, with 401, 413 or a throttling 429.

The WebAPI stores the request and answers 202 Accepted without running anything.

Postman with a POST to http://localhost/IManWebAPI/sage300orders/bulk answered 202 Accepted. The formatted body is the job's status document: id, status Queued, endpointId S300ASYNC, correlationId, instanceId null, submittedAt, startedAt, completedAt and expiresAt null, cancelRequested false, the statusUrl under /asyncjobs/, and resultUrl and error null

Three headers come with it:

  • Location: the job's status URL. It is the same as statusUrl in the body.
  • Retry-After: the number of seconds to wait before the first poll, 5.
  • X-Correlation-Id: the request's correlation id, also correlationId in the body. Request Logging describes how to use it.

The Headers tab of the same 202 response: Content-Type application/json, Location http://localhost/IManWebAPI/asyncjobs/ followed by the job id, Retry-After 5, X-Correlation-Id and the RateLimit headers

The endpoint's Result Status Code and its Request Timeout play no part in the 202. The Result Status Code applies to the result.

The status document

The 202 body and every answer to a poll carry the same JSON document. A time the job has not reached yet is null.

Property Holds
id The job id, a GUID that IMan generates.
status Queued, Running, Completed, Failed, Cancelled or Interrupted.
endpointId The endpoint's Endpoint ID.
correlationId The correlation id of the request that submitted the job.
instanceId The integration's instance number, from the moment the job starts running. Quote it to support with the correlation id.
submittedAt When the WebAPI accepted the request.
startedAt When the job started running.
completedAt When the job finished, in any of the four finished states.
expiresAt When IMan will remove the job and its result. See Retention.
cancelRequested true once the caller or an administrator has asked to cancel the job.
statusUrl The URL to poll.
resultUrl The URL of the result. Set only when status is Completed.
error Why the job failed or stopped. See When a job does not complete.

Times are UTC, with their offset: 2026-11-13T09:08:43.6930702+00:00.

Polling for the status

Send a GET to the status URL, with the same authentication as the submit.

Postman with a GET to the job's status URL answered 200 OK. The formatted body shows status Completed, endpointId S300ASYNC, instanceId 10, the submittedAt, startedAt, completedAt and expiresAt times, cancelRequested false, the statusUrl, and resultUrl set to the status URL followed by /result

While the job is waiting or running, the answer carries a Retry-After header: 5 seconds while Queued and 10 while Running. Wait at least that long between polls. A poll counts against the web user's request limit like any other request. Once the job has finished, the header is absent. Stop polling there.

Status Meaning
Queued Accepted and waiting to start.
Running The integration is running.
Completed The integration produced its response. Fetch it from resultUrl.
Failed The integration failed, or the job never started. error says which.
Cancelled The caller or an administrator cancelled the job before it completed.
Interrupted The engine process running the job ended without recording an outcome.

Completed means the integration produced a response, whatever its status code. A response that reports an error to the caller with 400 is still a completed job. A status only ever moves forward, with one exception: a job that IMan could not start because its integration was busy goes back to Queued and keeps its place.

Fetching the result

Send a GET to resultUrl. The WebAPI replays the response the integration produced, exactly as the synchronous endpoint would have sent it:

  • the status code a writer set, or else the endpoint's Result Status Code, or else 200;
  • the content type and the body, whether JSON, XML, text or a file;
  • a file as a download, with its file name;
  • a redirect from the Http Redirect Writer as a Location header.

Postman with a GET to the job's resultUrl answered 200 OK. The body is the created order: yourOrderReference PO16263002, ourOrderNumber ORD000000041951 and the three line items with their sku, description and qty

Fetch the result as often as you need until the job expires. Before the job has completed, the result URL answers 404:

{
  "status": 404,
  "title": "Not Found",
  "correlationId": "cab3c1fe-e5bb-4d7b-9126-d7c882683d9d",
  "error": "The asynchronous job [1de0ba0a-c8b7-4dcb-adce-a9f4a3dbbab6] has no result to replay: its status is Cancelled."
}

When a job does not complete

A job that ends in Failed, Cancelled or Interrupted carries an error object, the same shape as the WebAPI's other error responses:

Property Holds
status The HTTP status that describes the outcome.
title The name of that status, such as GatewayTimeout, or Cancelled for a cancel.
correlationId The job's correlation id.
error The message.
{
  "id": "1de0ba0a-c8b7-4dcb-adce-a9f4a3dbbab6",
  "status": "Cancelled",
  "endpointId": "S300ASYNC",
  "correlationId": "38eea779-63f4-4162-a5bc-448f023928e4",
  "instanceId": null,
  "submittedAt": "2026-11-13T09:17:20.8968467+00:00",
  "startedAt": null,
  "completedAt": "2026-11-13T09:18:45.9992106+00:00",
  "expiresAt": "2026-11-16T09:18:45.9992106+00:00",
  "cancelRequested": false,
  "statusUrl": "http://localhost/IManWebAPI/asyncjobs/1de0ba0a-c8b7-4dcb-adce-a9f4a3dbbab6",
  "resultUrl": null,
  "error": {
    "status": 409,
    "title": "Cancelled",
    "correlationId": "38eea779-63f4-4162-a5bc-448f023928e4",
    "error": "The asynchronous job was cancelled by an administrator."
  }
}
Outcome status error
The integration raised an error Failed The status the synchronous endpoint would have sent: the one a Check function raised, or else 500. The message is the integration's error.
The job did not start within the queue wait Failed 504. The request did not start within 60 minutes.
The endpoint was deleted at the moment the job was accepted Failed 410. The endpoint was deleted before the request started.
IMan could not start the engine Failed 500. The integration engine could not be started, with the reason.
A cancel reached the job while it was running Cancelled 409. The asynchronous job was cancelled before the integration completed.
An administrator cancelled the job while queued Cancelled 409. The asynchronous job was cancelled by an administrator.
The caller cancelled the job while queued Cancelled null. The caller already knows why.
The engine process ended without an outcome Interrupted 500. The integration engine process exited without recording an outcome.

The run's own audit report has the detail of a failure. Look it up by the job's instanceId.

Cancelling a job

Send a DELETE to the status URL. The answer depends on where the job is:

The job is Answer What happens
Queued 204 No Content The job becomes Cancelled and never runs.
Running 202 Accepted IMan asks the run to stop. Poll until the job is Cancelled, or Completed or Failed if it finished first. A repeated DELETE answers 202 again.
Finished 204 No Content IMan removes the job and its result now, rather than at expiresAt.

A sequence diagram in the same three lanes. Job queued: a DELETE to /asyncjobs/{id} makes the job Cancelled, the WebAPI answers 204 No Content, and the job never runs. Job running: the WebAPI records the cancel request and answers 202 Accepted. At its next check, every 5 seconds, the engine stops before the next transform, transaction or retry and the job becomes Cancelled. Records already written stay written. The caller's next poll reads Cancelled, or Completed or Failed if the job finished first

Postman with a DELETE to a queued job's status URL answered 204 No Content

Postman with a GET to the same job's status URL answered 200 OK. The body shows status Cancelled, instanceId and startedAt null, completedAt and expiresAt set, cancelRequested true, resultUrl null and error null

A running job stops at the next point where the engine checks for a cancel: before each transform, between transactions and while it waits to retry a failed call. The engine looks for a cancel request every 5 seconds. Once it has seen one, a job that fails still ends Cancelled. Records the job has already written stay written, and IMan writes no record halfway. A job that cancels after its last writer but before its response ends Cancelled with no result, although the data reached the target. The instanceId and the audit report show what the run did.

IMan never stops a running job on its own account. A job has no run-time limit.

Sending a request twice

A client that loses the 202, through a timeout or a dropped connection, cannot tell whether the WebAPI accepted the request. Sending it again would queue a second job. To make a resend safe, send an Idempotency-Key header with the request:

Idempotency-Key: PO16263030
  • The same key with the same body creates no new job. The WebAPI answers 200 OK with the existing job's status document, in whatever state it has reached.
  • The WebAPI refuses the same key with a different body with 422 Unprocessable Entity: A request with the Idempotency-Key [PO16263030] has already been accepted with a different body.
  • The WebAPI refuses a key longer than 200 characters with 400 Bad Request.

A sequence diagram with the caller and the IMan WebAPI. The WebAPI stores a POST with Idempotency-Key PO16263030 as a Queued job, but its 202 Accepted never reaches the caller. The caller sends the same request again, and the WebAPI finds the job by its key, creates no new job and answers 200 OK with the existing job's status. The same key with a different body creates no job and receives 422 Unprocessable Entity

A key belongs to the endpoint and the web user that sent it. Two web users can use the same key on one endpoint without colliding. IMan compares the body only, not the query string or the headers. The key lasts as long as its job: once the job expires or a DELETE removes it, the key is free again.

Use a value that identifies the batch, such as the client's own batch or order reference, or a GUID. On an anonymous endpoint every caller shares one set of keys. Use GUIDs there.

Who can read a job

A job belongs to the web user that submitted it. The status, result and DELETE routes authenticate the caller exactly as the job's endpoint does, with Basic, Bearer or the user token, and answer 404 to anyone else. A 404 looks the same for a job that belongs to another user, a job that does not exist and a job that has expired. The answer reveals nothing about other users' jobs.

On an endpoint that allows anonymous requests, nothing identifies the caller. The job id is the only key. It appears in the Location header, the status document and the WebAPI's logs, and anyone who holds it can read the result and cancel the job. Allow anonymous requests on an asynchronous endpoint only when the results are not sensitive.

If an administrator disables or deletes the web user, or removes it from the endpoint, its jobs still run, but nobody can read their results.

How IMan runs a job

The Realisable Scheduler Service runs asynchronous jobs. It must be running for any job to start. The WebAPI accepts and stores jobs while it is stopped.

  • The Scheduler starts the oldest queued job first. It runs up to Maximum concurrent asynchronous jobs at once across all asynchronous endpoints, 4 by default. A job beyond that waits in the queue.
  • A job also waits while its integration is already running as many instances as it allows, one by default, whether the other run is an asynchronous job or a scheduled run. The job keeps its place in the queue.
  • A job that has not started within its queue wait, 60 minutes by default, fails with 504. The wait counts from submission.
  • Pause Schedules, Scheduler Active Times and blackout periods on the Scheduling screen do not apply to asynchronous jobs.

The job runs as an ordinary run of the integration, in its own engine process under the Scheduler service's account. It gets an instance number, writes to the audit log, sends its audit report and appears in the Integration Monitor. It reads the request exactly as the synchronous endpoint would have, including the web user's custom property values as they were when the request arrived.

If the Scheduler stops while jobs are running, the jobs run on. When the Scheduler starts again it picks them up, or marks a job Interrupted if its engine process has gone. Queued jobs wait, and any whose queue wait passed while the Scheduler was stopped fail with 504.

Retention

IMan keeps a finished job and its result for the result retention, 72 hours by default, counted from when the job finished. expiresAt gives the time. After that, IMan removes both, and every route for the job answers 404. A DELETE removes a finished job at once. Queued and running jobs never expire.

Results stay in the IMan database until they expire. If an endpoint returns large results many times a day, a shorter retention keeps the database smaller. The Asynchronous Jobs page sets the defaults for queue wait and retention, and an endpoint can override either.

Limits

  • Queue length. The WebAPI accepts up to Maximum queued jobs, 100 by default, waiting at once. Beyond that, it refuses a new request with 429 Too Many Requests and Retry-After: 30: The asynchronous request queue is full: 100 requests are waiting and no more are accepted until some have been processed. Retry after 30 seconds. Running jobs do not count.
  • Request size. An asynchronous request has the same size limit as a synchronous one.
  • Request rate. The endpoint's and the web user's request throttling apply to the submit. Polls and result fetches count against the web user's limit.
  • Result size. IMan does not cap the size of a result.

Designing the integration

A request sent with the header Debug: True goes to the Designer synchronously, as it does for a synchronous endpoint. IMan creates no job. Design and test the integration exactly as WebAPI Integration Setup describes, then send requests without the header to run it as asynchronous jobs.

When things change while jobs exist

Change Queued jobs Running jobs Finished jobs
You delete the endpoint IMan refuses the delete IMan refuses the delete Readable until they expire
You switch the endpoint to Synchronous Run normally Finish normally Readable until they expire
You edit and save the integration Run the version saved when they start Keep the version they started with Unaffected
You remove the web user from the endpoint Run normally Finish normally Readable by nobody

While an endpoint has queued or running jobs, Delete is greyed out on the WebAPI Endpoints page. If a job arrives after you select the endpoint, IMan refuses the delete with Cannot delete the endpoint while it has queued or running asynchronous jobs. Cancel the jobs or let them finish, then delete the endpoint.

In the OpenAPI description

The OpenAPI description documents an asynchronous endpoint's operation with a 202 response, its Location and Retry-After headers and the status document as the AsyncJobStatus schema. It also lists the 200, 400, 422 and 429 answers and the optional Idempotency-Key header. Two further paths appear once any endpoint is asynchronous:

  • /asyncjobs/{id}, with GET for the status and DELETE to cancel;
  • /asyncjobs/{id}/result, with GET for the result.

The asyncjobs routes are reserved

The status and result routes begin asyncjobs/ under the WebAPI's application path. The endpoint editor refuses any route of your own that begins asyncjobs.