curl --request POST \
  --url 'https://api.glider.fi/v1/portfolio/port_abc123/rebalance/schedule/start' \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: your_api_key_here' \
  --data '{
    "runRebalanceImmediately": true,
    "initializeScheduleAutomatically": true,
    "interval": 21600000
  }'
{
  "success": true,
  "data": {
    "portfolioId": "port_abc123",
    "rebalanceScheduleId": "sched_abc123",
    "status": "started",
    "message": "Portfolio automation started successfully",
    "runRebalanceImmediately": true,
    "isAutomated": true,
    "intervalMs": 21600000
  },
  "correlationId": "corr_abc123",
  "requestId": "req_xyz789",
  "timestamp": "2023-05-21T13:45:12.345Z"
}
The Portfolio Automation endpoints allow you to start, pause, resume, and manage automated rebalancing of portfolios.

Start Portfolio Automation

Starts automated rebalancing for a portfolio.
portfolioId
string
required
The unique identifier of the portfolio
runRebalanceImmediately
boolean
default:"false"
Whether to run an initial rebalance immediately after starting
initializeScheduleAutomatically
boolean
default:"true"
Set to false for manual-only rebalancing without a schedule
interval
number
default:"21600000"
Rebalance interval in milliseconds (default: 6 hours)
curl --request POST \
  --url 'https://api.glider.fi/v1/portfolio/port_abc123/rebalance/schedule/start' \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: your_api_key_here' \
  --data '{
    "runRebalanceImmediately": true,
    "initializeScheduleAutomatically": true,
    "interval": 21600000
  }'
{
  "success": true,
  "data": {
    "portfolioId": "port_abc123",
    "rebalanceScheduleId": "sched_abc123",
    "status": "started",
    "message": "Portfolio automation started successfully",
    "runRebalanceImmediately": true,
    "isAutomated": true,
    "intervalMs": 21600000
  },
  "correlationId": "corr_abc123",
  "requestId": "req_xyz789",
  "timestamp": "2023-05-21T13:45:12.345Z"
}

Pause Portfolio Automation

Pauses automated rebalancing for a portfolio.
portfolioId
string
required
The unique identifier of the portfolio
reason
string
Optional reason for pausing
curl --request POST \
  --url 'https://api.glider.fi/v1/portfolio/port_abc123/rebalance/schedule/pause' \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: your_api_key_here' \
  --data '{
    "reason": "Pausing for market volatility"
  }'
{
  "success": true,
  "data": {
    "portfolioId": "port_abc123",
    "scheduleId": "sched_abc123",
    "status": "paused",
    "message": "Portfolio automation paused successfully",
    "paused": true,
    "pausedAt": "2023-05-21T13:45:12.345Z",
    "reason": "Paused via API: Pausing for market volatility"
  },
  "correlationId": "corr_abc123",
  "requestId": "req_xyz789",
  "timestamp": "2023-05-21T13:45:12.345Z"
}

Resume Portfolio Automation

Resumes previously paused automated rebalancing for a portfolio.
portfolioId
string
required
The unique identifier of the portfolio
reason
string
Optional reason for resuming
curl --request POST \
  --url 'https://api.glider.fi/v1/portfolio/port_abc123/rebalance/schedule/resume' \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: your_api_key_here' \
  --data '{
    "reason": "Market stabilized"
  }'
{
  "success": true,
  "data": {
    "portfolioId": "port_abc123",
    "scheduleId": "sched_abc123",
    "status": "active",
    "message": "Portfolio automation resumed successfully",
    "paused": false,
    "resumedAt": "2023-05-21T13:45:12.345Z",
    "reason": "Resumed via API: Market stabilized"
  },
  "correlationId": "corr_abc123",
  "requestId": "req_xyz789",
  "timestamp": "2023-05-21T13:45:12.345Z"
}

Manually Trigger Rebalance

Manually triggers a portfolio rebalance.
portfolioId
string
required
The unique identifier of the portfolio
skipScheduleValidation
boolean
default:"false"
Set to true to trigger a rebalance even if no schedule exists
curl --request POST \
  --url 'https://api.glider.fi/v1/portfolio/port_abc123/rebalance/schedule/trigger' \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: your_api_key_here' \
  --data '{
    "skipScheduleValidation": false
  }'
{
  "success": true,
  "data": {
    "portfolioId": "port_abc123",
    "scheduleId": "sched_abc123",
    "rebalanceId": "rebal_def456",
    "status": "triggered",
    "message": "Portfolio rebalance triggered successfully",
    "triggerTime": 1684734312
  },
  "correlationId": "corr_abc123",
  "requestId": "req_xyz789",
  "timestamp": "2023-05-21T13:45:12.345Z"
}

Check Automation Status

Checks the status of portfolio automation.
portfolioId
string
required
The unique identifier of the portfolio
curl --request GET \
  --url 'https://api.glider.fi/v1/portfolio/port_abc123/automation/status' \
  --header 'X-API-KEY: your_api_key_here'
{
  "success": true,
  "data": {
    "portfolioId": "port_abc123",
    "status": "active", // or "paused", "inactive", "archived", "error"
    "hasAutomation": true,
    "message": "Portfolio automation is active",
    "rebalanceScheduleId": "sched_abc123",
    "details": {
      "totalExecutions": 5,
      "paused": false,
      "pauseReason": null,
      "recentActions": [
        {
          "workflowId": "rebal_def456",
          "takenAt": "2023-05-21T13:30:00.000Z",
          "scheduledAt": "2023-05-21T13:30:00.000Z"
        },
        {
          "workflowId": "rebal_ghi789",
          "takenAt": "2023-05-21T07:30:00.000Z",
          "scheduledAt": "2023-05-21T07:30:00.000Z"
        }
      ],
      "nextScheduledExecution": "2023-05-21T19:30:00.000Z"
    }
  },
  "correlationId": "corr_abc123",
  "requestId": "req_xyz789",
  "timestamp": "2023-05-21T13:45:12.345Z"
}

Check Rebalance Status

Checks the status of portfolio rebalancing.
portfolioId
string
required
The unique identifier of the portfolio
limit
number
default:"5"
Number of recent workflows to return
curl --request GET \
  --url 'https://api.glider.fi/v1/portfolio/port_abc123/rebalance/status?limit=5' \
  --header 'X-API-KEY: your_api_key_here'
{
  "success": true,
  "data": {
    "portfolioId": "port_abc123",
    "status": "active", // or "paused", "inactive", "error"
    "message": "Rebalance schedule is active",
    "rebalanceScheduleId": "sched_abc123",
    "details": {
      "totalExecutions": 5,
      "paused": false,
      "pauseReason": null,
      "nextScheduledExecution": "2023-05-21T19:30:00.000Z"
    },
    "recentWorkflows": [
      {
        "workflowId": "rebal_def456",
        "runId": "run_jkl012",
        "scheduledAt": "2023-05-21T13:30:00.000Z",
        "startedAt": "2023-05-21T13:30:00.123Z",
        "status": "triggered"
      },
      {
        "workflowId": "rebal_ghi789",
        "runId": "run_mno345",
        "scheduledAt": "2023-05-21T07:30:00.000Z",
        "startedAt": "2023-05-21T07:30:00.456Z",
        "status": "triggered"
      }
    ]
  },
  "correlationId": "corr_abc123",
  "requestId": "req_xyz789",
  "timestamp": "2023-05-21T13:45:12.345Z"
}

Check Specific Rebalance Execution

Gets detailed information about a specific rebalance execution.
portfolioId
string
required
The unique identifier of the portfolio
workflowId
string
required
The ID of the rebalance workflow execution
curl --request GET \
  --url 'https://api.glider.fi/v1/portfolio/port_abc123/rebalance/status/rebal_def456' \
  --header 'X-API-KEY: your_api_key_here'
{
  "success": true,
  "data": {
    "portfolioId": "port_abc123",
    "workflowId": "rebal_def456",
    "runId": "run_jkl012",
    "status": "completed",
    "startTime": "2023-05-21T13:30:00.123Z",
    "closeTime": "2023-05-21T13:32:45.678Z",
    "executionTime": "2023-05-21T13:30:00.123Z",
    "taskQueue": "rebalance-queue",
    "result": {
      "transactionHash": "0xTransactionHash789",
      "blockNumber": 12345680,
      "gasUsed": "125000",
      "effectiveGasPrice": "1000000000",
      "status": "success"
    },
    "error": null,
    "historyLength": 32
  },
  "correlationId": "corr_abc123",
  "requestId": "req_xyz789",
  "timestamp": "2023-05-21T13:45:12.345Z"
}

Update Schedule Interval

Updates the rebalance schedule interval for a portfolio.
portfolioId
string
required
The unique identifier of the portfolio
interval
object
required
The new interval settings
interval.every
number
required
Interval in milliseconds (min: 1 hour, max: 1 year)
interval.offset
number
default:"0"
Offset from start time in milliseconds
curl --request POST \
  --url 'https://api.glider.fi/v1/portfolio/port_abc123/update-schedule-interval' \
  --header 'Content-Type: application/json' \
  --header 'X-API-KEY: your_api_key_here' \
  --data '{
    "interval": {
      "every": 43200000,
      "offset": 0
    }
  }'
{
  "success": true,
  "data": {
    "portfolioId": "port_abc123",
    "scheduleId": "sched_abc123",
    "previousInterval": {
      "every": 21600000,
      "offset": 0
    },
    "newInterval": {
      "every": 43200000,
      "offset": 0,
      "humanReadable": "12 hours"
    },
    "message": "Portfolio rebalance schedule updated to run every 12 hours",
    "nextScheduledRun": "2023-05-22T01:30:00.000Z"
  },
  "correlationId": "corr_abc123",
  "requestId": "req_xyz789",
  "timestamp": "2023-05-21T13:45:12.345Z"
}