# Flow Deployment

## Tables

There are two tables you need to know about: flow\_deployments and flow\_deployment\_tags.

### flow\_deployments

<figure><img src="/files/nOT0Q7kP5uB4cPKyH2uk" alt=""><figcaption><p>flow_deployments table</p></figcaption></figure>

Read-only columns: we don't enforce column-level permissions at the moment, updating these column will cause problems.

* **id**: ID of the deployment, we use UUIDv7, therefore we can sort deployments by ID and the result will be ordered by creation time.
* **created\_at**
* **user\_id**: owner of the deployment.
* **entrypoint**: Flow ID, the main flow of this deployment, when starting the deployment, this flow will be called.

Customizable columns: update these columns to change the behavior of the deployment

* **start\_permission**: specify who can call this deployment, this column replace is\_public, start\_shared, start\_unverified columns of flows table. Possible values:

  * "Owner": only owner of the deployment.
  * "Authenticated": any authenticated user.
  * "Anonymous": unauthenticated user (start\_flow\_unverified).

  Default value will be inferred from flow config.
* **output\_instructions**: (true/false) if set to true, will stop flow and return the transaction when available. Default is false.
* **action\_identity**: (public key) When set, will append an [Action Identity memo](https://solana.com/docs/advanced/actions#action-identifier-message) to instructions. Deployment owner must also have a hard-coded wallet with this public key. Default: null.
* **fees**: specify address and amount to send fee to. Default: empty list. Example:

```json
[
 ["2cruTfCER3HaFwXnR99uM3jM1nPAPR5eWmVF2PiM7viR", 10000],
 ["9tmSkymh34zo33DJYcKxhHBHMhdLyWNMPtvgA1cz1occ", 10000]
]
```

* **solana\_network**: Solana cluster and RPC URL. Default: same as flow config. Example:

```json
{
  "url": "https://api.devnet.solana.com",
  "cluster": "devnet"
}
```

### flow\_deployments\_tags

Tags allow calling flow deployments in a human-friendly way.

<figure><img src="/files/XL5zY6W9BgeCloFWGrZ9" alt=""><figcaption></figcaption></figure>

A "latest" tag will be created automatically and point to the latest deployment of a flow.

<figure><img src="/files/GRHyS7FePMw9cUeZ4lYV" alt=""><figcaption></figcaption></figure>

## API Authentication

**All examples will need authentication headers, using one of the methods below. I will omit them for brevity.**

Using access token:

```bash
-H "Authorization: Bearer $ACCESS_TOKEN"
```

Using API key:

```bash
-H "x-api-key: $API_KEY"
```

Unauthenticated user, using public key (like in start\_flow\_unverified):

```bash
-H "Authorization: Bearer $PUBLIC_KEY"
```

## Deploy a flow

Request:

```bash
curl -X POST https://dev-api.spaceoperator.com/flow/deploy/$FLOW_ID
```

Only owner of flow can deploy.

Response:

```json
{"deployment_id":"0194e5ac-9103-7c52-971e-f71f83c5de2e"}
```

Inserted row in flow\_deployments table:

```json
{
  "id": "0194e5ac-9103-7c52-971e-f71f83c5de2e",
  "created_at": "2025-02-08 13:07:59.35528",
  "user_id": "885623c5-d001-41da-9d34-5577e49df350",
  "entrypoint": 3675,
  "start_permission": "Owner",
  "output_instructions": false,
  "action_identity": null,
  "fees": [],
  "solana_network": {
    "url": "https://api.devnet.solana.com",
    "cluster": "devnet"
  }
}
```

Inserted row in flow\_deployments\_tags table:

```json
{
  "user_id": "885623c5-d001-41da-9d34-5577e49df350",
  "entrypoint": 3675,
  "tag": "latest",
  "deployment_id": "0194e5ac-9103-7c52-971e-f71f83c5de2e",
  "description": null
}
```

## Call a deployment

We unify /start, /start\_shared, /start\_unverified into only one /deployment/start route. It depends on which user is calling:

* If it is the owner, behavior is same as /start
* If it is another user, behavior is same as /start\_shared
* If it is an unauthenticated user, /start\_unverified

Column start\_permission will decide which users can call the deployment. Note: if the wrong user is calling, it will return a "404 not found" error instead of a permission error.

You can specify deployment either by ID or by flow ID and tag.&#x20;

Call via ID:

```bash
curl -X POST https://dev-api.spaceoperator.com/deployment/start?id=$ID
```

Call via flow ID and tag:

```bash
curl -X POST https://dev-api.spaceoperator.com/deployment/start?flow=$FLOW_ID&tag=$TAG
```

If you don't specify tag, default "latest" tag will be used:

```bash
curl -X POST https://dev-api.spaceoperator.com/deployment/start?flow=$FLOW_ID
```

JSON request body:

```typescript
export interface StartDeploymentParams {
  inputs?: Record<string, IValue>;
  action_signer?: string;
}
```

Example body:

```json
{
  "inputs": {
    "sender": {
      "S": "5B1yr3JTyijfCfrsvHTgSkVEQWNMCE7w6f1WQkuBzAfK"
    },
    "amount": {
      "D": "3.14"
    }
  },
  "action_signer": "5B1yr3JTyijfCfrsvHTgSkVEQWNMCE7w6f1WQkuBzAfK"
}
```

Response: same as start flow response

```json
{
  "flow_run_id": "5ede3d1a-67ae-452a-95ee-189d76377dd5",
  "token": "fr-Xt49GmeuRSqV7hiddjd91Q323_SUWZ5ViPUJXoNHh9yJ_Tf60y0bG6p1bfthzPtR"
}
```

You can query flow\_run of a deployment using the new flow\_run.deployment\_id column:

```typescript
supabase
    .from("flow_run")
    .select("*")
    .eq("deployment_id", id);
```

Normal flow\_run will have deployment\_id set to null.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.spaceoperator.com/references/flow-deployment.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
