# Execute a Hrana JSON v3 pipeline

Source: https://docs.wabe.sh/api-reference/operations/hranapipeline/

`POST https://api.wabe.sh/v1/disks/{disk}/sqlite/{database}/hrana/v3/pipeline`

SDK base /v1/disks/{disk}/sqlite/{database}/hrana/. Named databases are independent within a disk. Bearer authentication is required on every continuation. Transaction TTL defaults to 60 seconds, idle sessions outside a transaction to 30 seconds. The previous custom SQL and libsql URI routes are disabled. Protobuf, WebSocket and replication are outside this profile.

## Authorization

Project API key from the Wabe Dashboard or actor runtime access token for the disk URL supplied by the broker.

## Parameters

- `disk` (path, string, required) — Project disk name, or the disk ID in the actor runtime disk URL.

- `database` (path, string, required)

## Request body

`application/json`

Example

```json
{
  "requests": [
    {
      "type": "execute",
      "stmt": {
        "sql": "SELECT 1 AS n"
      }
    },
    {
      "type": "close"
    }
  ]
}
```

Schema

```json
{
  "type": "object",
  "required": [
    "requests"
  ],
  "properties": {
    "baton": {
      "type": [
        "string",
        "null"
      ],
      "description": "Omit or use null for a new session. Pass the latest baton to continue; the SDK rotates tokens. A cursor header baton becomes usable only after body EOF."
    },
    "requests": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "type": "string",
            "enum": [
              "execute",
              "batch",
              "sequence",
              "describe",
              "get_autocommit",
              "store_sql",
              "close_sql",
              "close"
            ]
          }
        },
        "description": "Operation payload follows the Hrana JSON v3 profile; execute has stmt, batch has batch.steps, SQL-cache operations use sql_id and SQL text."
      }
    }
  }
}
```

## Responses

### 200

Protocol results; statement errors can occur inside HTTP 200. SQL COMMIT acknowledges buffered state without an object-store flush. Cursor EOF alone does not commit an open transaction.

`application/json`

Example

```json
{
  "baton": null,
  "base_url": null,
  "results": [
    {
      "type": "ok",
      "response": {
        "type": "execute",
        "result": {
          "cols": [
            {
              "name": "n",
              "decltype": null
            }
          ],
          "rows": [
            [
              {
                "type": "integer",
                "value": "1"
              }
            ]
          ],
          "affected_row_count": 0,
          "last_insert_rowid": null
        }
      }
    },
    {
      "type": "ok",
      "response": {
        "type": "close"
      }
    }
  ]
}
```

Schema

```json
{
  "type": "object",
  "required": [
    "baton",
    "base_url",
    "results"
  ],
  "properties": {
    "baton": {
      "type": [
        "string",
        "null"
      ],
      "description": "Omit or use null for a new session. Pass the latest baton to continue; the SDK rotates tokens. A cursor header baton becomes usable only after body EOF."
    },
    "base_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "results": {
      "type": "array",
      "items": {
        "type": "object",
        "required": [
          "type"
        ],
        "properties": {
          "type": {
            "enum": [
              "ok",
              "error"
            ]
          },
          "response": {
            "type": "object",
            "description": "Successful operation result, including typed statement values or batch step results/errors."
          },
          "error": {
            "type": "object",
            "required": [
              "code",
              "message"
            ],
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              },
              "extended_code": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  }
}
```

### 400

Invalid names or protocol request.

### 401

Missing, invalid or revoked project API key, or an invalid runtime access token.

`application/json`

Schema

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}
```

### 403

Actor runtime token does not authorize this disk or instance generation.

`application/json`

Schema

```json
{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}
```

### 404

Invalid, expired, wrong-scope or retired-session baton.

### 408

SQL execution/admission/backpressure deadline expired.

### 413

Request or configured resource limit exceeded.

### 503

SQL execution unavailable or storage failure.
