---
orphan: true
---

# Export agent package

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

```text
GET https://moi.matrixorigin.cn/newmoi/workspaces/{workspace_id}/agent-packages/{agent_id}/versions/{version}/export
```

## Before you call

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

## Request example

```bash
curl "https://moi.matrixorigin.cn/newmoi/workspaces/$WORKSPACE_ID/agent-packages/$AGENT_ID/versions/$VERSION/export" -H "X-API-Key: $AI_STUDIO_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"}
```
