# Get run source (/en/docs/api/native/automation/getRunSource)





Read the source and digest used by the run. Results include the language and SHA-256 digest, for both ad hoc and published-definition runs.

`GET /automation/v1/runs/{id}/source`

## Authentication [#authentication]

`Authorization: Bearer $PRAXIS_API_KEY`

## Request fields [#request-fields]

| Parameter | Type | Description |
| --- | --- | --- |
| path: id | `string` | required; Run ID (run_). |

## Examples [#examples]

[SDK installation and example environment](/en/docs/api/native/automation)

Set these environment variables to your own resources:

| Variable | Source |
| --- | --- |
| RUN_ID | [Run id; suspend/resume require a workflow; cancel requires a nonterminal run](/en/docs/api/native/automation/createRun) |

```bash
: "${RUN_ID:?Set RUN_ID}"
curl --fail-with-body -X GET "https://api.deepraxis.ai/automation/v1/runs/${RUN_ID}/source" \
  -H "Authorization: Bearer $PRAXIS_API_KEY"
```

```typescript
import { createAutomationClient } from '@deepraxis/sdk/automation';

function env(name: string): string {
  const value = process.env[name];
  if (!value) throw new Error(`Set ${name}`);
  return value;
}
const automation = createAutomationClient({
  apiKey: env('PRAXIS_API_KEY'),
  baseUrl: 'https://api.deepraxis.ai',
  maxRetries: 0,
  timeoutMs: 90_000,
});
const result = await automation.runs.retrieveSource({
  "path": {
    "id": env("RUN_ID")
  }
});
console.log(result);
```

## Response [#response]

### HTTP 200 [#http-200]

Success

`application/json`

| Field | Type | Description |
| --- | --- | --- |
| language | `"ts"` / `"yaml"` | required; Source language. ts is a TypeScript script; yaml is workflow YAML. |
| source | `string` | required; Full source (ts or yaml) the run used. |
| sha256 | `string` | required; SHA-256 digest of the source; usable as expected_source_sha256 when publishing. |

### Measured response [#measured-response]

HTTP 200

```json
{
  "language": "ts",
  "source": "export default async (input: { n: number }) => ({ answer: input.n + 1 });",
  "sha256": "7ae6678882a4ef2ea96e401c105d5c6ef512917cd72a9235289d2a3bf1f1b49d"
}
```

## Errors [#errors]

| HTTP | Codes and description |
| --- | --- |
| 400 | INVALID_PARAMS: Invalid request parameters, path, cursor, or body format. |
| 404 | RUN_NOT_FOUND: The run does not exist or is not visible to this tenant. |
| default | RFC 9457 automation problem. 429 includes Retry-After. |

[Authentication and common errors](/en/docs/api/errors) · Retain the `X-Request-Id` response header for troubleshooting.
