> ## Documentation Index
> Fetch the complete documentation index at: https://docs.usehasp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# API Reference

> Programmatic surfaces for AI Studio — the public authoring API, the internal JSON API on the platform, A2A on the org runtime host, and the public AI API for inference.

HASP exposes four HTTP surfaces that matter to AI Studio integrators. They are intentionally separate: **public authoring** (API-key authenticated project/schema/workflow management), **Studio management** (session-authenticated builders on the platform), **agent runtime** (org subdomain — discovery + A2A invocation), and **AI inference** (public API gateway).

## 1. Public authoring API

**Base URL:** `https://api.usehasp.com/v1`
**Authentication:** `Authorization: Bearer hasp_api_live_<key>` (or a delegated `hasp_agt_*` credential)

This is the **supported programmatic path** for creating and managing Studio projects, entity schemas, and workflows from your own systems. Unlike the internal API below, it is API-key authenticated, versioned, and covered by the published OpenAPI document.

| Method                   | Endpoint                                                 | Description                     |
| ------------------------ | -------------------------------------------------------- | ------------------------------- |
| `GET`, `POST`            | `/v1/projects`                                           | List projects; create a project |
| `GET`, `PATCH`           | `/v1/projects/{project}`                                 | Project detail; update          |
| `POST`                   | `/v1/projects/{project}/archive`                         | Archive a project               |
| `GET`, `POST`            | `/v1/projects/{project}/schemas`                         | List entity schemas; create one |
| `GET`, `PATCH`, `DELETE` | `/v1/projects/{project}/schemas/{entity}`                | Entity detail; update; delete   |
| `POST`                   | `/v1/projects/{project}/schemas/{entity}/fields`         | Add a field                     |
| `PATCH`, `DELETE`        | `/v1/projects/{project}/schemas/{entity}/fields/{field}` | Update; delete a field          |
| `GET`, `POST`            | `/v1/projects/{project}/workflows`                       | List workflows; create one      |
| `GET`, `PATCH`           | `/v1/projects/{project}/workflows/{workflow}`            | Workflow detail; update         |
| `POST`                   | `/v1/projects/{project}/workflows/{workflow}/publish`    | Publish a workflow              |
| `POST`                   | `/v1/projects/{project}/workflows/{workflow}/runs`       | Start a run                     |
| `GET`                    | `/v1/projects/{project}/runs`                            | List runs across the project    |
| `GET`                    | `/v1/projects/{project}/runs/{run}`                      | Run detail                      |

Field `type` values for the schemas endpoints are the [entity field types](/studio/entities#field-types). Full request/response shapes are in the interactive **AI API → Endpoints** reference on this site.

## 2. HASP Internal API (Studio management)

**Base URL:** `https://app.usehasp.com`

These routes power AI Studio in the browser. They are defined in **TypeSpec** (`apps/platform/api/` in the HASP monorepo) and compiled to OpenAPI (`apps/platform/api/openapi.yaml`). All endpoints are shown as full absolute URLs; the common path prefix is `/api/internal/`.

**Authentication:** Session-backed requests from signed-in org members (same auth model as the Studio UI), not `api.usehasp.com` API keys. These power the Studio UI in the browser and are not a supported integration surface — for programmatic project, schema, and workflow management use the [public authoring API](#1-public-authoring-api) above.

### Projects & structure

| Method                   | Endpoint                                                                       | Description                     |
| ------------------------ | ------------------------------------------------------------------------------ | ------------------------------- |
| `GET`, `POST`            | `https://app.usehasp.com/api/internal/projects`                                | List projects; create a project |
| `GET`, `PATCH`, `DELETE` | `https://app.usehasp.com/api/internal/projects/{project_id}`                   | Project detail; update; archive |
| `GET`, `POST`            | `https://app.usehasp.com/api/internal/projects/{project_id}/apps`              | Apps in the project             |
| `GET`, `POST`            | `https://app.usehasp.com/api/internal/projects/{project_id}/workflows`         | Workflows                       |
| `GET`, `POST`            | `https://app.usehasp.com/api/internal/projects/{project_id}/entities`          | Entities                        |
| `GET`, `POST`            | `https://app.usehasp.com/api/internal/projects/{project_id}/webhooks`          | Webhooks                        |
| `GET`, `PATCH`           | `https://app.usehasp.com/api/internal/projects/{project_id}/policy`            | Project policy                  |
| `GET`, `POST`            | `https://app.usehasp.com/api/internal/projects/{project_id}/members`           | List members; add / invite      |
| `PATCH`, `DELETE`        | `https://app.usehasp.com/api/internal/projects/{project_id}/members/{user_id}` | Member updates                  |

### Dashboards & activity

| Method | Endpoint                                                                         | Description                    |
| ------ | -------------------------------------------------------------------------------- | ------------------------------ |
| `GET`  | `https://app.usehasp.com/api/internal/orgs/{org_id}/dashboard/overview`          | Org dashboard rollup           |
| `GET`  | `https://app.usehasp.com/api/internal/orgs/{org_id}/dashboard/projects`          | Org project list for dashboard |
| `GET`  | `https://app.usehasp.com/api/internal/orgs/{org_id}/dashboard/health-rollup`     | Aggregate health               |
| `GET`  | `https://app.usehasp.com/api/internal/projects/{project_id}/dashboard/overview`  | Project overview               |
| `GET`  | `https://app.usehasp.com/api/internal/projects/{project_id}/dashboard/activity`  | Activity feed                  |
| `GET`  | `https://app.usehasp.com/api/internal/projects/{project_id}/dashboard/audit-log` | Project audit log              |
| `GET`  | `https://app.usehasp.com/api/internal/projects/{project_id}/dashboard/analytics` | Analytics                      |

### Releases

| Method        | Endpoint                                                                        | Description           |
| ------------- | ------------------------------------------------------------------------------- | --------------------- |
| `GET`, `POST` | `https://app.usehasp.com/api/internal/projects/{project_id}/releases`           | List / create release |
| `GET`         | `https://app.usehasp.com/api/internal/releases/{release_id}`                    | Release detail        |
| `POST`        | `https://app.usehasp.com/api/internal/releases/{release_id}/approve`            | Approve               |
| `POST`        | `https://app.usehasp.com/api/internal/releases/{release_id}/cancel`             | Cancel                |
| `POST`        | `https://app.usehasp.com/api/internal/releases/{release_id}/deploy`             | Deploy                |
| `POST`        | `https://app.usehasp.com/api/internal/releases/{release_id}/reject`             | Reject                |
| `POST`        | `https://app.usehasp.com/api/internal/releases/{release_id}/rollback`           | Rollback              |
| `POST`        | `https://app.usehasp.com/api/internal/releases/{release_id}/emergency-rollback` | Emergency rollback    |

### Traces & workflow runs

| Method        | Endpoint                                                             | Description                           |
| ------------- | -------------------------------------------------------------------- | ------------------------------------- |
| `GET`         | `https://app.usehasp.com/api/internal/projects/{project_id}/traces`  | List traces                           |
| `GET`         | `https://app.usehasp.com/api/internal/traces/{trace_id}`             | Trace detail                          |
| `POST`        | `https://app.usehasp.com/api/internal/traces/{trace_id}/replay`      | Replay                                |
| `GET`         | `https://app.usehasp.com/api/internal/traces/{trace_id}/export`      | Export trace                          |
| `POST`        | `https://app.usehasp.com/api/internal/traces/{trace_id}/elevate-phi` | PHI-elevated view (policy-controlled) |
| `GET`, `POST` | `https://app.usehasp.com/api/internal/workflows/{workflow_id}/runs`  | List runs; create run                 |
| `POST`        | `https://app.usehasp.com/api/internal/workflows/{workflow_id}/test`  | Test execution                        |

### Entities & records

| Method                   | Endpoint                                                                        | Description           |
| ------------------------ | ------------------------------------------------------------------------------- | --------------------- |
| `GET`, `PATCH`, `DELETE` | `https://app.usehasp.com/api/internal/entities/{entity_id}`                     | Entity schema         |
| `GET`, `POST`            | `https://app.usehasp.com/api/internal/entities/{entity_id}/records`             | List / create records |
| `GET`, `PATCH`, `DELETE` | `https://app.usehasp.com/api/internal/entities/{entity_id}/records/{record_id}` | Record CRUD           |

### Integrations, webhooks, settings

| Method                   | Endpoint                                                                           | Description       |
| ------------------------ | ---------------------------------------------------------------------------------- | ----------------- |
| `GET`, `POST`            | `https://app.usehasp.com/api/internal/orgs/{org_id}/integrations`                  | Org integrations  |
| `GET`, `PATCH`, `DELETE` | `https://app.usehasp.com/api/internal/orgs/{org_id}/integrations/{integration_id}` | Integration CRUD  |
| `POST`                   | `https://app.usehasp.com/api/internal/integrations/{integration_id}/test`          | Test connection   |
| `GET`, `PATCH`, `DELETE` | `https://app.usehasp.com/api/internal/webhooks/{webhook_id}`                       | Webhook resource  |
| `GET`                    | `https://app.usehasp.com/api/internal/webhooks/{webhook_id}/receipts`              | Inbound receipts  |
| `POST`                   | `https://app.usehasp.com/api/internal/webhooks/{webhook_id}/test`                  | Test webhook      |
| `GET`, `PATCH`           | `https://app.usehasp.com/api/internal/orgs/{org_id}/settings/phi-policy`           | Org PHI policy    |
| `GET`, `PATCH`           | `https://app.usehasp.com/api/internal/orgs/{org_id}/settings/release-policy`       | Org release floor |

### Discovery (capability surfacing for builders)

| Method | Endpoint                                                                        | Description              |
| ------ | ------------------------------------------------------------------------------- | ------------------------ |
| `GET`  | `https://app.usehasp.com/api/internal/orgs/{org_id}/discovery/apps`             | Apps gallery / discovery |
| `GET`  | `https://app.usehasp.com/api/internal/orgs/{org_id}/discovery/workflows`        | Workflows gallery        |
| `GET`  | `https://app.usehasp.com/api/internal/orgs/{org_id}/discovery/agentic-patterns` | Agentic patterns index   |

### Palette (authoring assist)

| Method | Endpoint                                               | Description     |
| ------ | ------------------------------------------------------ | --------------- |
| `POST` | `https://app.usehasp.com/api/internal/palette/query`   | Palette query   |
| `POST` | `https://app.usehasp.com/api/internal/palette/execute` | Palette execute |

### TypeSpec source of truth

The machine-readable contract is generated from TypeSpec — **not** hand-maintained in this docs repo. When a path or schema changes, the platform export is authoritative. If you need exhaustive request/response shapes, use `openapi.yaml` from the platform tree or ask HASP for a published export.

***

## 3. Org runtime — A2A & discovery

**Base URL:** `https://{org}.usehasp.run` (or your Enterprise custom domain)

| Method | Endpoint                                                       | Description                                                                                                                                                                                                                  |
| ------ | -------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `GET`  | `https://{org}.usehasp.run/.well-known/agents.json`            | Public capability manifest (agent-callable workflows)                                                                                                                                                                        |
| `POST` | `https://{org}.usehasp.run/a2a/{project_slug}/{workflow_slug}` | JSON-RPC 2.0 (`method: "invoke"`); **Authorization:** `Bearer hasp_agt_*` delegated agent credential or `hasp_api_live_*` org API key, bound to the subdomain's org and holding `workflow.run` ([A2A](/studio/a2a-protocol)) |

See [A2A protocol](/studio/a2a-protocol) for payloads, auth, and standards alignment.

***

## 4. Public AI API (inference gateway)

**Base URL:** `https://api.usehasp.com/v1`

Inference, native chat, and Anthropic-compatible `/messages` live here. Authenticate with a HASP API key:

```
Authorization: Bearer hasp_api_live_<key>
```

Interactive reference and the published OpenAPI document ship with this site under **AI API**. Start at [AI API quickstart](/ai-api/quickstart).

***

## Related docs

* [App Builder SDK](/app-builder/getting-started) — client-side data API for workflow apps on `usehasp.run`
* [A2A protocol](/studio/a2a-protocol) — agents, discovery, JSON-RPC invocation
* [Platform compliance](/platform/compliance-posture) — BAA, audit, and trust context
