跳到正文
RunAPI 开发者文档
API 参考
API 参考

取消 Upload

幂等取消 pending Upload。

幂等取消 pending Upload。

端点

POST /v1/uploads/:upload_id/cancel
基础 URL
https://runapi.ai
API 版本
v1
身份验证
Authorization: Bearer YOUR_API_KEY
02

请求

JSON 请求体

只能在列出的请求位置发送值。

路径参数1 个字段
upload_idstring
必填

RunAPI Upload ID.

03

成功响应

HTTP 200

POST /v1/uploads/:upload_id/cancel

JSON
{
  "bytes": 1048576,
  "created_at": 1785196800,
  "expires_at": 1785200400,
  "filename": "archive.bin",
  "id": "upload_abc123",
  "object": "upload",
  "purpose": "user_data",
  "status": "cancelled"
}
04

错误响应 (401)

HTTP 401
响应 Schema
JSON
{
  "additionalProperties": true,
  "properties": {
    "error": {
      "additionalProperties": true,
      "properties": {
        "code": {
          "type": [
            "string",
            "null"
          ]
        },
        "message": {
          "type": "string"
        },
        "param": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "message",
        "type"
      ],
      "type": "object"
    }
  },
  "required": [
    "error"
  ],
  "type": "object"
}

响应示例

JSON
{
  "error": {
    "code": "authentication_error",
    "message": "Missing API key",
    "param": null,
    "type": "authentication_error"
  }
}
05

错误响应 (400)

HTTP 400
响应 Schema
JSON
{
  "additionalProperties": true,
  "properties": {
    "error": {
      "additionalProperties": true,
      "properties": {
        "code": {
          "type": [
            "string",
            "null"
          ]
        },
        "message": {
          "type": "string"
        },
        "param": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "message",
        "type"
      ],
      "type": "object"
    }
  },
  "required": [
    "error"
  ],
  "type": "object"
}

响应示例

JSON
{
  "error": {
    "code": "invalid_request_error",
    "message": "Malformed request",
    "param": null,
    "type": "invalid_request_error"
  }
}
06

错误响应 (404)

HTTP 404
响应 Schema
JSON
{
  "additionalProperties": true,
  "properties": {
    "error": {
      "additionalProperties": true,
      "properties": {
        "code": {
          "type": [
            "string",
            "null"
          ]
        },
        "message": {
          "type": "string"
        },
        "param": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "message",
        "type"
      ],
      "type": "object"
    }
  },
  "required": [
    "error"
  ],
  "type": "object"
}

响应示例

JSON
{
  "error": {
    "code": "not_found",
    "message": "File not found",
    "param": null,
    "type": "invalid_request_error"
  }
}
07

错误响应 (409)

HTTP 409
响应 Schema
JSON
{
  "additionalProperties": true,
  "properties": {
    "error": {
      "additionalProperties": true,
      "properties": {
        "code": {
          "type": [
            "string",
            "null"
          ]
        },
        "message": {
          "type": "string"
        },
        "param": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "message",
        "type"
      ],
      "type": "object"
    }
  },
  "required": [
    "error"
  ],
  "type": "object"
}

响应示例

JSON
{
  "error": {
    "code": "upload_state_conflict",
    "message": "Upload state conflict",
    "param": null,
    "type": "invalid_request_error"
  }
}
08

错误响应 (413)

HTTP 413
响应 Schema
JSON
{
  "additionalProperties": true,
  "properties": {
    "error": {
      "additionalProperties": true,
      "properties": {
        "code": {
          "type": [
            "string",
            "null"
          ]
        },
        "message": {
          "type": "string"
        },
        "param": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "message",
        "type"
      ],
      "type": "object"
    }
  },
  "required": [
    "error"
  ],
  "type": "object"
}

响应示例

JSON
{
  "error": {
    "code": "file_too_large",
    "message": "File size exceeds the maximum allowed size",
    "param": "file",
    "type": "invalid_request_error"
  }
}
09

错误响应 (422)

HTTP 422
响应 Schema
JSON
{
  "additionalProperties": true,
  "properties": {
    "error": {
      "additionalProperties": true,
      "properties": {
        "code": {
          "type": [
            "string",
            "null"
          ]
        },
        "message": {
          "type": "string"
        },
        "param": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "message",
        "type"
      ],
      "type": "object"
    }
  },
  "required": [
    "error"
  ],
  "type": "object"
}

响应示例

JSON
{
  "error": {
    "code": "invalid_upload",
    "message": "Upload request rejected",
    "param": null,
    "type": "invalid_request_error"
  }
}
10

错误响应 (502)

HTTP 502
响应 Schema
JSON
{
  "additionalProperties": true,
  "properties": {
    "error": {
      "additionalProperties": true,
      "properties": {
        "code": {
          "type": [
            "string",
            "null"
          ]
        },
        "message": {
          "type": "string"
        },
        "param": {
          "type": [
            "string",
            "null"
          ]
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "message",
        "type"
      ],
      "type": "object"
    }
  },
  "required": [
    "error"
  ],
  "type": "object"
}

响应示例

JSON
{
  "error": {
    "code": "storage_write_failed",
    "message": "File storage failed",
    "param": null,
    "type": "server_error"
  }
}
11

cURL 示例

CURL
curl -X POST https://runapi.ai/v1/uploads/upload_abc123/cancel \
  -H 'Authorization: Bearer YOUR_API_KEY'