> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://infonite.dev/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://infonite.dev/_mcp/server.

# Poll the state

HEAD https://clients.infonite.tech/api/executions/handler/v1/{execution_id}

The state of an execution as an HTTP code, with no body. The cheapest way to poll, and the one to put in a loop.

| Code  | Meaning                                   | What to do                                                                                                                                                         |
| :---- | :---------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `200` | Finished. Nothing about it will change.   | Read the results, or [the state](api:GET/executions/handler/v1/\{execution_id}) if you want to know how it went.                                                   |
| `202` | Still working.                            | Ask again later.                                                                                                                                                   |
| `423` | Waiting for an answer from your customer. | Fetch [the state](api:GET/executions/handler/v1/\{execution_id}) for the form, then reply to [Resume an Execution](api:PUT/executions/handler/v1/\{execution_id}). |
| `404` | No such execution for your application.   | Check the id — a deleted execution answers the same way.                                                                                                           |

**No answer from this endpoint has a body** — not the `200`, not the `404`. `HEAD` returns headers only, by definition, so the status line *is* the answer and there is nothing to parse. Whatever example a client library prints for an empty response, the socket carries no bytes.

**`200` does not mean *successful*, it means *closed*.** A failed execution is finished too, and this endpoint cannot tell you which it was: the reason lives in the state. Branch on `status_reason`, never on the fact that the poll stopped returning `202`.

**Poll politely, or stop polling.** An engine that talks to a bank takes tens of seconds, not milliseconds — a few seconds between checks is plenty. [Webhooks](/direct-executions/webhooks) replace the loop entirely, and the `ended` event is the only one you have to handle.

**Server to server only.** This call is authorised with your application secret: it belongs in your backend, never in a browser, a mobile app or anything your customer can read.

Reference: https://infonite.dev/api-reference/direct-executions/direct-executions-api/handling-the-state/direct-executions-v-1-handler-status

## Authentication

- `X-APP-SECRET` header (required) — Application Secret

## Servers

- `https://clients.infonite.tech/api` (Legacy Server, default)
- `https://clients.infonite.io/api` (Production Server)

## Request

### Path parameters

- `execution_id` (string, required) — The execution, as the acceptance response returned it.

## Response

### 200

**200 OK****Closed, not necessarily successful.** The execution is over and nothing about it will change; whether it produced anything is in `status_reason`, which this answer does not carry. Read [the state](api:GET/executions/handler/v1/\{execution_id}) or go straight to the results.

### 202

**202 Accepted**Still working. Nothing is wrong — ask again in a few seconds.

## Errors

### 404 Not Found Error

**404 Not Found**No execution with that id for your application, or it has been deleted. A deleted execution answers exactly like one that never existed.

- `any`

### 422 Unprocessable Entity Error

**422 Unprocessable Content**The id in the path is not an execution id. **Like every other answer here it carries no body**, so there is nothing to read: check what you are polling with.

- `detail` (list of object, required)
  - `loc` (list of string or integer, required)
  - `msg` (string, required)
  - `type` (string, required)
  - `input` (any, optional)
  - `ctx` (object, optional)

### 423 Locked Error

**423 Locked**Paused: the source is asking for something only your customer can give. The form is in [the state](api:GET/executions/handler/v1/\{execution_id}), and the answer goes to [Resume an Execution](api:PUT/executions/handler/v1/\{execution_id}).

- `any`

## Examples

**SDK Code**

```python
import requests

url = "https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36"

headers = {"X-APP-SECRET": "<apiKey>"}

response = requests.head(url, headers=headers)

print(response.json())
```

```javascript
const url = 'https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36';
const options = {method: 'HEAD', headers: {'X-APP-SECRET': '<apiKey>'}};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"net/http"
	"io"
)

func main() {

	url := "https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36"

	req, _ := http.NewRequest("HEAD", url, nil)

	req.Header.Add("X-APP-SECRET", "<apiKey>")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Head.new(url)
request["X-APP-SECRET"] = '<apiKey>'

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.head("https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36")
  .header("X-APP-SECRET", "<apiKey>")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('HEAD', 'https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36', [
  'headers' => [
    'X-APP-SECRET' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36");
var request = new RestRequest(Method.HEAD);
request.AddHeader("X-APP-SECRET", "<apiKey>");
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["X-APP-SECRET": "<apiKey>"]

let request = NSMutableURLRequest(url: NSURL(string: "https://clients.infonite.tech/api/executions/handler/v1/6aa3d8b418d1c5dc9a8e3d36")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "HEAD"
request.allHTTPHeaderFields = headers

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```