Docs

Cancel Midnight offer groups

Builds and simulates an unconditional, complete cancellation of one or more offer groups. group_id values come from the Morpho API /v0/midnight/users/{user_address}/offer-groups or the groups returned by the offer-publication routes.


POST
/v0/actions/midnight/offers/cancel

Each group must belong to the account and already be returned by the Morpho API /v0/midnight/offer-groups/{group_id}. A group published moments ago may return 422 ACTION_UNSUPPORTED; retry shortly. Cancellation does not withdraw supplied funding. After cancellation confirms, recover variable-rate funding with POST /v0/actions/midnight/offers/funding/withdraw using the publication response's funding_address and the id of its funding_market.

Authorization

ApiKeyAuth
x-api-key<token>

Send your Morpho-issued key on every action request. JWKS needs no key on every host; public documentation needs no key.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/v0/actions/midnight/offers/cancel" \  -H "Content-Type: application/json" \  -d '{    "account": "0x6aBB9Aeb93e9aF04c8D9FD2b84BF6ca8EDC3eAf2",    "chain_id": 8453,    "groups": [      "0x1111111111111111111111111111111111111111111111111111111111111111"    ]  }'
{  "data": {    "action_id": "act_0123456789abcdef0123456789abcdef",    "status": "prepared",    "action": "midnight.cancel_offers",    "chain_id": 8453,    "account": "0x6aBB9Aeb93e9aF04c8D9FD2b84BF6ca8EDC3eAf2",    "expires_at": 1760001800,    "groups": [      "0x1111111111111111111111111111111111111111111111111111111111111111"    ],    "calls": [      {        "id": "call_0",        "kind": "cancel_and_publish",        "to": "0x0bF30B530f816a619C3F28a3b9f44C441122555D",        "data": "0xb4691380000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000002a000000000000000000000000000000000000000000000000000000000000003c00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000003e000000000000000000000000000000000000000000000000000000000000004400000000000000000000000000000000000000000000000000000000068e77f08000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001111111111111111111111111111111111111111111111111111111111111111100000000000000000000000000000000ffffffffffffffffffffffffffffffff0000000000000000000000000000000000000000000000000000000000000000",        "value": "0"      }    ],    "simulation": {      "status": "success",      "block": {        "number": "21000000",        "timestamp": 1760000000      },      "wallet_changes": [],      "position_changes": {},      "effects": {        "cancelled_groups": [          "0x1111111111111111111111111111111111111111111111111111111111111111"        ]      }    }  }}
{  "error": {    "code": "REQUEST_ABORTED",    "message": "string",    "details": [      {        "code": "string",        "message": "string",        "path": [          "string"        ],        "rule": "string",        "details": {          "min_assets": "string",          "loan_token": "string"        }      }    ],    "request_id": "string"  }}
{  "error": {    "code": "NOT_FOUND",    "message": "string",    "details": [      {        "code": "string",        "message": "string",        "path": [          "string"        ],        "rule": "string",        "details": {          "min_assets": "string",          "loan_token": "string"        }      }    ],    "request_id": "string"  }}
{  "error": {    "code": "PAYLOAD_TOO_LARGE",    "message": "string",    "details": [      {        "code": "string",        "message": "string",        "path": [          "string"        ],        "rule": "string",        "details": {          "min_assets": "string",          "loan_token": "string"        }      }    ],    "request_id": "string"  }}
{  "error": {    "code": "ACTION_CONTINUATION_INVALID",    "message": "string",    "details": [      {        "code": "string",        "message": "string",        "path": [          "string"        ],        "rule": "string",        "details": {          "min_assets": "string",          "loan_token": "string"        }      }    ],    "request_id": "string"  }}
Empty
{  "error": {    "code": "INTERNAL_ERROR",    "message": "string",    "details": [      {        "code": "string",        "message": "string",        "path": [          "string"        ],        "rule": "string",        "details": {          "min_assets": "string",          "loan_token": "string"        }      }    ],    "request_id": "string"  }}
{  "error": {    "code": "CONTRACT_CODE_MISSING",    "message": "string",    "details": [      {        "code": "string",        "message": "string",        "path": [          "string"        ],        "rule": "string",        "details": {          "min_assets": "string",          "loan_token": "string"        }      }    ],    "request_id": "string"  }}