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

# Portfolio Archive

> Archive or unarchive a portfolio

These endpoints allow you to archive and unarchive portfolios. Archiving a portfolio pauses rebalance schedules and blocks archive-gated portfolio actions, while still allowing users to withdraw funds manually.

## Archive a Portfolio

```
POST /portfolio/:portfolioId/archive
```

Archives a portfolio, pausing rebalance schedules and blocking archive-gated portfolio actions.

### Path Parameters

<ParamField path="portfolioId" type="string" required>
  The unique identifier of the portfolio to archive
</ParamField>

### Request Headers

<ParamField header="X-API-KEY" type="string" required>
  Your API key
</ParamField>

<ParamField header="Content-Type" type="string" required>
  Must be set to `application/json`
</ParamField>

### Request Body

<ParamField body="reason" type="string">
  Reason for archiving the portfolio (optional)
</ParamField>

### Response

<ResponseField name="success" type="boolean">
  Indicates if the request was successful
</ResponseField>

<ResponseField name="data" type="object">
  <Expandable title="Properties">
    <ResponseField name="portfolio" type="object">
      The archived portfolio information

      <Expandable title="Portfolio Object">
        <ResponseField name="id" type="string">
          Portfolio identifier
        </ResponseField>

        <ResponseField name="status" type="string">
          New status: "archived"
        </ResponseField>

        <ResponseField name="archivedAt" type="string">
          Timestamp when the portfolio was archived
        </ResponseField>

        <ResponseField name="archivedBy" type="string">
          Identifier of the entity that archived the portfolio
        </ResponseField>

        <ResponseField name="archiveReason" type="string">
          Reason provided for archiving
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

## Unarchive a Portfolio

```
POST /portfolio/:portfolioId/unarchive
```

Unarchives a previously archived portfolio, restoring archive-gated portfolio actions.

### Path Parameters

<ParamField path="portfolioId" type="string" required>
  The unique identifier of the portfolio to unarchive
</ParamField>

### Request Headers

<ParamField header="X-API-KEY" type="string" required>
  Your API key
</ParamField>

<ParamField header="Content-Type" type="string" required>
  Must be set to `application/json`
</ParamField>

### Request Body

<ParamField body="resumeSchedules" type="boolean" default="false">
  Whether to resume previous rebalance schedules
</ParamField>

### Response

<ResponseField name="success" type="boolean">
  Indicates if the request was successful
</ResponseField>

<ResponseField name="data" type="object">
  <Expandable title="Properties">
    <ResponseField name="portfolio" type="object">
      The unarchived portfolio information

      <Expandable title="Portfolio Object">
        <ResponseField name="id" type="string">
          Portfolio identifier
        </ResponseField>

        <ResponseField name="status" type="string">
          New status: "active"
        </ResponseField>

        <ResponseField name="unarchivedAt" type="string">
          Timestamp when the portfolio was unarchived
        </ResponseField>

        <ResponseField name="unarchivedBy" type="string">
          Identifier of the entity that unarchived the portfolio
        </ResponseField>

        <ResponseField name="schedules" type="array">
          Information about rebalance schedules (if resumeSchedules=true)
        </ResponseField>
      </Expandable>
    </ResponseField>
  </Expandable>
</ResponseField>

## Example Archive Request

```bash theme={null}
curl -X POST "https://api.glider.fi/portfolio/port_1a2b3c4d5e6f/archive" \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "reason": "No longer in use"
  }'
```

## Example Archive Response

```json theme={null}
{
  "success": true,
  "data": {
    "portfolio": {
      "id": "port_1a2b3c4d5e6f",
      "status": "archived",
      "archivedAt": "2023-05-15T14:30:00Z",
      "archivedBy": "api_user_123",
      "archiveReason": "No longer in use"
    }
  }
}
```

## Example Unarchive Request

```bash theme={null}
curl -X POST "https://api.glider.fi/portfolio/port_1a2b3c4d5e6f/unarchive" \
  -H "X-API-KEY: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "resumeSchedules": true
  }'
```

## Example Unarchive Response

```json theme={null}
{
  "success": true,
  "data": {
    "portfolio": {
      "id": "port_1a2b3c4d5e6f",
      "status": "active",
      "unarchivedAt": "2023-05-20T09:15:00Z",
      "unarchivedBy": "api_user_123",
      "schedules": [
        {
          "id": "sched_1a2b3c4d",
          "type": "threshold",
          "status": "active"
        }
      ]
    }
  }
}
```

## Error Codes

<ResponseField name="NOT_FOUND" type="404">
  The specified portfolio could not be found
</ResponseField>

<ResponseField name="UNAUTHORIZED" type="401">
  Invalid or missing API key
</ResponseField>

<ResponseField name="FORBIDDEN" type="403">
  The API key does not have permission to manage this portfolio
</ResponseField>

<ResponseField name="BAD_REQUEST" type="400">
  The portfolio is already in the requested state (e.g., archiving an already archived portfolio)
</ResponseField>

## Notes

* Archiving a portfolio is a non-destructive action - no data or assets are removed
* All active rebalance schedules are automatically paused when a portfolio is archived
* When unarchiving, you can choose whether to resume previous rebalance schedules
* While archived, withdrawals remain available, but archive-gated actions like rebalancing and portfolio updates remain blocked
* Portfolio data remains accessible for reporting and historical analysis
* The archive reason is stored for audit and reporting purposes
