# Export agent package

Export the `.moiagent` package of the specified agent version.

```text
GET $CLOUDSIGMA_API_BASE/workspaces/{workspace_id}/agent-packages/{agent_id}/versions/{version}/export
```

## Before you call this API

Configure the [regional API endpoint and authentication](https://omnifabric.cloudsigma.com/docs/developer/endpoints-and-authentication.html.md), and select the target workspace.

The example below uses `$CLOUDSIGMA_API_KEY`, `$WORKSPACE_ID`, `$AGENT_ID` and `$VERSION` (agent versions).

## Request example

```bash
curl "$CLOUDSIGMA_API_BASE/workspaces/$WORKSPACE_ID/agent-packages/$AGENT_ID/versions/$VERSION/export" -H "X-API-Key: $CLOUDSIGMA_API_KEY" -H "X-Workspace-ID: $WORKSPACE_ID" -o agent.moiagent
```

## Successful response

Returns `200` and the packet file byte stream on success.

## Error response

```json
{"code":5,"message":"agent version not found"}
```
