# Run a gateway tool call from another machine's sandbox (https://www.codevisor.dev/docs/api-reference/server/post-gateway-invoke)

## POST /v1/gateway/invoke

Run a gateway tool call from another machine's sandbox

## OpenAPI definition

```json

{
  "openapi": "3.2.0",
  "info": {
    "title": "Codevisor Server API",
    "version": "v1-experimental",
    "description": "Experimental public API for projects, coding-agent sessions, extensions, files, events, and terminals on a Codevisor server."
  },
  "servers": [
    {
      "url": "http://127.0.0.1:49361",
      "description": "Default local server. If 49361 is taken it uses the next free port up to 49399; `codevisor status` shows the port."
    }
  ],
  "tags": [
    {
      "name": "Server"
    },
    {
      "name": "Authentication"
    },
    {
      "name": "Updates"
    },
    {
      "name": "Projects"
    },
    {
      "name": "Workspaces"
    },
    {
      "name": "Harnesses"
    },
    {
      "name": "Plugins"
    },
    {
      "name": "MCP servers"
    },
    {
      "name": "Skills"
    },
    {
      "name": "Sessions"
    },
    {
      "name": "Files"
    },
    {
      "name": "Events"
    },
    {
      "name": "Terminals"
    }
  ],
  "paths": {
    "/v1/gateway/invoke": {
      "post": {
        "operationId": "post-gateway-invoke",
        "tags": [
          "Server"
        ],
        "summary": "Run a gateway tool call from another machine's sandbox",
        "security": [
          {
            "bearerAuth": []
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "result": {}
                  },
                  "required": [
                    "result"
                  ],
                  "additionalProperties": false,
                  "$defs": {}
                }
              }
            }
          },
          "400": {
            "$ref": "#/components/responses/BadRequest"
          },
          "401": {
            "$ref": "#/components/responses/Unauthorized"
          },
          "404": {
            "$ref": "#/components/responses/NotFound"
          },
          "409": {
            "$ref": "#/components/responses/Conflict"
          },
          "422": {
            "$ref": "#/components/responses/InvalidRequest"
          },
          "500": {
            "$ref": "#/components/responses/ServerError"
          }
        },
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "properties": {
                  "path": {
                    "type": "string"
                  },
                  "args": {
                    "anyOf": [
                      {},
                      {
                        "type": "null"
                      }
                    ]
                  },
                  "origin": {
                    "type": "object",
                    "properties": {
                      "machineId": {
                        "type": "string"
                      },
                      "machineName": {
                        "type": "string"
                      },
                      "sessionId": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "sessionTitle": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "clientId": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "botId": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      },
                      "botMachineId": {
                        "anyOf": [
                          {
                            "type": "string"
                          },
                          {
                            "type": "null"
                          }
                        ]
                      }
                    },
                    "required": [
                      "machineId",
                      "machineName"
                    ],
                    "additionalProperties": false
                  }
                },
                "required": [
                  "path",
                  "origin"
                ],
                "additionalProperties": false,
                "$defs": {}
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "bearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "Codevisor pairing token"
      }
    },
    "responses": {
      "BadRequest": {
        "description": "The JSON body is malformed or does not match the request schema.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "required": [
                "error"
              ],
              "properties": {
                "error": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            }
          }
        }
      },
      "Unauthorized": {
        "description": "A valid bearer token is required for non-local requests.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "required": [
                "error"
              ],
              "properties": {
                "error": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            }
          }
        }
      },
      "NotFound": {
        "description": "The requested resource does not exist.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "required": [
                "error"
              ],
              "properties": {
                "error": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            }
          }
        }
      },
      "Conflict": {
        "description": "The request conflicts with the resource's current state.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "required": [
                "error"
              ],
              "properties": {
                "error": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            }
          }
        }
      },
      "InvalidRequest": {
        "description": "The request is well formed but cannot be applied.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "required": [
                "error"
              ],
              "properties": {
                "error": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            }
          }
        }
      },
      "ServerError": {
        "description": "The server could not complete the request.",
        "content": {
          "application/json": {
            "schema": {
              "type": "object",
              "required": [
                "error"
              ],
              "properties": {
                "error": {
                  "type": "string"
                }
              },
              "additionalProperties": false
            }
          }
        }
      }
    }
  }
}

```