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

# Get Instance

> Fetch process instance details — deployment parameters, status, version, and active workflows

## When to use

* Check what deployment parameters (INSTPARM values) are set on a live instance
* Verify the deployment status and version of an instance
* See which workflows are deployed and their n8n workflow IDs
* Confirm an instance is active before triggering workflows

## Prerequisites

* `codika` CLI installed and authenticated
* A deployed process instance (via `deploy use-case` or the dashboard)
* API key with `instances:read` scope

## Typical workflow

```bash theme={null}
# 1. Deploy a use case
codika deploy use-case .

# 2. Rerun the deployment with parameters
codika rerun deployment --param TO_EMAILS='["ops@acme.com"]'

# 3. Verify the parameters are set correctly
codika get instance --environment prod

# 4. If wrong, rerun the deployment with corrected parameters
codika rerun deployment --environment prod --param TO_EMAILS='["correct@acme.com"]'
```

## Command

```bash theme={null}
codika get instance [processInstanceId] [options]
```

## Arguments

| Argument              | Description                                                      |
| --------------------- | ---------------------------------------------------------------- |
| `[processInstanceId]` | Process instance ID (optional — auto-resolved from project.json) |

## Options

| Option                  | Description                                                        | Default           |
| ----------------------- | ------------------------------------------------------------------ | ----------------- |
| `--path <path>`         | Path to use case folder with `project.json`                        | Current directory |
| `--project-file <path>` | Path to custom project file (e.g., `project-client-a.json`)        | `project.json`    |
| `--environment <env>`   | Environment: `dev` or `prod`                                       | `dev`             |
| `--workflows`           | Show expanded workflow details (triggers, activation status, cost) | —                 |
| `--api-url <url>`       | Override API URL                                                   | —                 |
| `--api-key <key>`       | Override API key                                                   | —                 |
| `--profile <name>`      | Use a specific profile instead of the active one                   | —                 |
| `--json`                | Output as JSON                                                     | —                 |

## Process instance ID resolution

The instance ID is resolved in this order:

1. Positional argument (explicit ID)
2. `project.json` in `--path` directory — uses `devProcessInstanceId` or `prodProcessInstanceId` based on `--environment`
3. `project.json` in current directory — same environment-aware selection

Use `--environment prod` to target the production instance from project.json.

## Examples

```bash theme={null}
# Explicit instance ID
codika get instance 019d312f-517c-726e-83ac-b678f2ad6afc

# From a use case folder (dev instance)
codika get instance --path ./my-use-case

# Production instance from project.json
codika get instance --environment prod

# JSON output for scripting
codika get instance --environment prod --json

# With a custom project file
codika get instance --project-file project-client-a.json --environment prod

# Expanded workflow details (triggers, activation, cost)
codika get instance --workflows
```

## Output

### Human-readable (default)

```
✓ Process Instance

  Instance ID:    019d312f-517c-726e-83ac-b678f2ad6afc
  Process ID:     11fe8iPQ4pBlskVIknz4
  Environment:    prod
  Status:         deployed (active)
  Version:        1.50
  Title:          Creafid Receipt Processor

  Deployment Parameters:
    TO_EMAILS: [] (empty)
    CC_EMAILS: [] (empty)

  Workflows:
    - http-process-receipt (n8n: NGC6dwX7WL1F29DI)
    - http-get-receipts (n8n: XE4RRqOIaJF1m8Fu)
    - http-manage-clients (n8n: o1bvAUtugGH9PgRr)
```

### With `--workflows` flag

```
✓ Process Instance

  Instance ID:    019d312f-517c-726e-83ac-b678f2ad6afc
  ...

  Workflows:
    http-process-receipt
      n8n ID:     NGC6dwX7WL1F29DI
      Active:     yes
      Triggers:   http (POST)
      Cost:       0.02 credits

    scheduled-report
      n8n ID:     XE4RRqOIaJF1m8Fu
      Active:     yes
      Triggers:   schedule (0 6 * * *)
```

### JSON output with `--workflows` (`--json`)

```json theme={null}
{
  "success": true,
  "data": {
    "processInstanceId": "019d444d-...",
    "deployment": {
      "workflows": [
        {
          "workflowId": "competitor-news-monitoring",
          "n8nWorkflowId": "pE5dKk7zbLQ6hdLg",
          "workflowName": "Competitor News Monitoring",
          "n8nWorkflowIsActive": true,
          "triggers": [
            { "type": "http", "method": "POST" },
            { "type": "schedule", "cronExpression": "0 8 * * *", "timezone": "Europe/Brussels" }
          ],
          "cost": 25,
          "integrationUids": ["tavily"]
        }
      ]
    }
  }
}
```

Without `--workflows`, each workflow only contains `workflowId`, `n8nWorkflowId`, and `workflowName` (backward compatible).

### JSON output (`--json`)

```json theme={null}
{
  "success": true,
  "data": {
    "processInstanceId": "019d312f-517c-726e-83ac-b678f2ad6afc",
    "processId": "11fe8iPQ4pBlskVIknz4",
    "environment": "prod",
    "isActive": true,
    "archived": false,
    "currentVersion": "1.50",
    "title": "Creafid Receipt Processor",
    "organizationId": "xwk9CcT440Vupa8soIhY",
    "installedAt": "2026-03-27T10:00:00.000Z",
    "lastExecutedAt": "2026-03-31T14:30:00.000Z",
    "deployment": {
      "deploymentInstanceId": "abc123",
      "deploymentStatus": "deployed",
      "deploymentParameters": {
        "TO_EMAILS": [],
        "CC_EMAILS": []
      },
      "deploymentInputSchema": [],
      "workflows": [
        {
          "workflowId": "http-process-receipt",
          "n8nWorkflowId": "NGC6dwX7WL1F29DI",
          "workflowName": "Process Receipt (HTTP)"
        }
      ]
    }
  },
  "requestId": "019d312f-..."
}
```

## Status values

| Status              | Meaning                           |
| ------------------- | --------------------------------- |
| `deployed (active)` | Workflows are deployed and active |
| `deployed (paused)` | Workflows are deployed but paused |
| `deploying`         | Deployment is in progress         |
| `pending`           | Awaiting first deployment         |
| `failed`            | Deployment failed                 |
| `archived`          | Instance has been archived        |

## Exit codes

| Code | Meaning                                                     |
| ---- | ----------------------------------------------------------- |
| `0`  | Success                                                     |
| `1`  | API error or instance not found                             |
| `2`  | CLI validation error (missing instance ID, missing API key) |
