FousDocs

API reference

Schemas

Complete request and response definitions from the public API contract.

QueryRequest

Provide prompt OR api + operation + input. Allowed and blocked API lists must not overlap. Use include alone, or schema with optional mapping.

json
{
  "type": "object",
  "description": "Provide prompt OR api + operation + input. Allowed and blocked API lists must not overlap. Use include alone, or schema with optional mapping.",
  "properties": {
    "api": {
      "type": "string",
      "pattern": "^@[a-z0-9][a-z0-9_-]{0,99}$"
    },
    "operation": {
      "type": "string",
      "pattern": "^[a-z][a-z0-9_]{0,99}$"
    },
    "version": {
      "type": "integer",
      "description": "Pin an immutable method contract version. Omit to keep the method’s established default version; publishing a new version never moves that default. Only valid with api, operation and input.",
      "exclusiveMinimum": 0,
      "maximum": 2147483647
    },
    "input": {
      "$ref": "#/components/schemas/QueryRequest/$defs/__schema0"
    },
    "prompt": {
      "type": "string",
      "minLength": 1,
      "maxLength": 10000
    },
    "allowed_apis": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^@[a-z0-9][a-z0-9_-]{0,99}$"
      },
      "minItems": 1,
      "maxItems": 100,
      "uniqueItems": true
    },
    "blocked_apis": {
      "type": "array",
      "items": {
        "type": "string",
        "pattern": "^@[a-z0-9][a-z0-9_-]{0,99}$"
      },
      "minItems": 1,
      "maxItems": 100,
      "uniqueItems": true
    },
    "attachments": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "pattern": "^file_[0-9a-f]{32}$"
          },
          "purpose": {
            "type": "string",
            "enum": [
              "input",
              "context"
            ],
            "default": "input"
          }
        },
        "required": [
          "id"
        ],
        "additionalProperties": false
      },
      "maxItems": 4
    },
    "stream": {
      "type": "boolean"
    },
    "response": {
      "type": "object",
      "properties": {
        "format": {
          "type": "string",
          "enum": [
            "json",
            "text",
            "markdown"
          ],
          "default": "json"
        },
        "include": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1000
          },
          "minItems": 1,
          "maxItems": 1000,
          "uniqueItems": true
        },
        "schema": {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {}
        },
        "mapping": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "target": {
                "type": "string",
                "maxLength": 1000
              },
              "source": {
                "type": "string",
                "maxLength": 1000
              }
            },
            "required": [
              "target",
              "source"
            ],
            "additionalProperties": false
          },
          "minItems": 1,
          "maxItems": 1000
        }
      },
      "additionalProperties": false,
      "allOf": [
        {
          "not": {
            "anyOf": [
              {
                "required": [
                  "include",
                  "schema"
                ]
              },
              {
                "required": [
                  "include",
                  "mapping"
                ]
              }
            ]
          }
        },
        {
          "if": {
            "required": [
              "mapping"
            ]
          },
          "then": {
            "required": [
              "schema"
            ]
          }
        }
      ]
    },
    "visibility": {
      "type": "string",
      "description": "A handle reaches your organization’s private API and the public API alike; a private method wins a name collision. Set public or private to use one side only.",
      "enum": [
        "public",
        "private"
      ]
    }
  },
  "additionalProperties": false,
  "$defs": {
    "__schema0": {
      "anyOf": [
        {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "number"
            },
            {
              "type": "boolean"
            },
            {
              "type": "null"
            }
          ]
        },
        {
          "type": "array",
          "items": {
            "$ref": "#/components/schemas/QueryRequest/$defs/__schema0"
          }
        },
        {
          "type": "object",
          "propertyNames": {
            "type": "string"
          },
          "additionalProperties": {
            "$ref": "#/components/schemas/QueryRequest/$defs/__schema0"
          }
        }
      ]
    }
  },
  "oneOf": [
    {
      "required": [
        "prompt"
      ],
      "not": {
        "anyOf": [
          {
            "required": [
              "operation"
            ]
          },
          {
            "required": [
              "input"
            ]
          },
          {
            "required": [
              "version"
            ]
          }
        ]
      }
    },
    {
      "required": [
        "api",
        "operation",
        "input"
      ],
      "not": {
        "required": [
          "prompt"
        ]
      }
    }
  ]
}

Receipt

json
{
  "type": "object",
  "properties": {
    "request_id": {
      "type": "string"
    },
    "api": {
      "type": [
        "string",
        "null"
      ]
    },
    "operation": {
      "type": [
        "string",
        "null"
      ]
    },
    "billing": {
      "type": "object",
      "properties": {
        "status": {
          "enum": [
            "not_started",
            "pending",
            "settled",
            "released"
          ]
        },
        "reserved_credits": {
          "type": "number"
        },
        "charged_credits": {
          "type": [
            "number",
            "null"
          ]
        }
      },
      "required": [
        "status",
        "reserved_credits",
        "charged_credits"
      ],
      "additionalProperties": false
    }
  },
  "required": [
    "request_id",
    "api",
    "operation",
    "billing"
  ],
  "additionalProperties": false
}

QueryResult

json
{
  "type": "object",
  "properties": {
    "success": {
      "const": true
    },
    "data": {
      "type": "object",
      "properties": {
        "output": {},
        "receipt": {
          "$ref": "#/components/schemas/Receipt"
        }
      },
      "required": [
        "output",
        "receipt"
      ],
      "additionalProperties": true
    }
  },
  "required": [
    "success",
    "data"
  ],
  "additionalProperties": false
}

Error

json
{
  "type": "object",
  "properties": {
    "success": {
      "const": false
    },
    "error": {
      "type": "object",
      "properties": {
        "type": {
          "type": "string"
        },
        "code": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "status": {
          "type": "integer"
        },
        "request_id": {
          "type": "string"
        },
        "param": {
          "type": "string"
        },
        "doc_url": {
          "type": "string"
        },
        "details": {},
        "receipt": {
          "$ref": "#/components/schemas/Receipt"
        }
      },
      "required": [
        "type",
        "code",
        "message",
        "status"
      ],
      "additionalProperties": true
    }
  },
  "required": [
    "success",
    "error"
  ],
  "additionalProperties": false
}

RequestStatus

json
{
  "type": "object",
  "properties": {
    "success": {
      "const": true
    },
    "data": {
      "type": "object",
      "properties": {
        "request_id": {
          "type": "string"
        },
        "status": {
          "type": "string"
        },
        "result": {
          "oneOf": [
            {
              "$ref": "#/components/schemas/QueryResult"
            },
            {
              "$ref": "#/components/schemas/Error"
            },
            {
              "type": "null"
            }
          ]
        },
        "response_status": {
          "type": [
            "number",
            "null"
          ]
        },
        "result_expires_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "error_code": {
          "type": [
            "string",
            "null"
          ]
        },
        "receipt": {
          "$ref": "#/components/schemas/Receipt"
        },
        "feedback": {
          "enum": [
            1,
            -1,
            null
          ]
        },
        "can_rate": {
          "type": "boolean"
        },
        "feedback_unavailable_reason": {
          "type": [
            "string",
            "null"
          ]
        }
      },
      "required": [
        "request_id",
        "status"
      ],
      "additionalProperties": true
    }
  },
  "required": [
    "success",
    "data"
  ],
  "additionalProperties": false
}

File

json
{
  "type": "object",
  "properties": {
    "id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "content_type": {
      "type": "string"
    },
    "size": {
      "type": "integer"
    },
    "expires_at": {
      "type": "string",
      "format": "date-time"
    }
  },
  "required": [
    "id",
    "name",
    "content_type",
    "size",
    "expires_at"
  ],
  "additionalProperties": false
}

CatalogApi

json
{
  "type": "object",
  "properties": {
    "api": {
      "type": "string",
      "pattern": "^@[a-z0-9][a-z0-9_-]{0,99}$",
      "example": "@x_com"
    },
    "name": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "category": {
      "type": "string",
      "enum": [
        "ai",
        "blockchain",
        "commerce",
        "communication",
        "data",
        "developer-tools",
        "documents",
        "education",
        "energy",
        "entertainment",
        "finance",
        "food",
        "government",
        "health",
        "identity",
        "jobs",
        "legal",
        "logistics",
        "maps",
        "marketing",
        "media",
        "news",
        "payments",
        "productivity",
        "real-estate",
        "science",
        "search",
        "security",
        "social",
        "sports",
        "storage",
        "travel",
        "weather",
        "other"
      ]
    },
    "website_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "logo_url": {
      "type": [
        "string",
        "null"
      ]
    },
    "availability": {
      "type": "string"
    },
    "visibility": {
      "const": "public"
    },
    "is_enabled": {
      "const": true
    },
    "operations": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer"
          },
          "operation": {
            "type": "string"
          },
          "label": {
            "type": "string"
          },
          "contract_version": {
            "type": "integer"
          },
          "cost_credits": {
            "type": "number"
          }
        },
        "additionalProperties": true
      }
    }
  },
  "required": [
    "api",
    "name",
    "operations"
  ],
  "additionalProperties": true
}

Tool

json
{
  "type": "object",
  "properties": {
    "name": {
      "type": "string"
    },
    "title": {
      "type": "string"
    },
    "description": {
      "type": "string"
    },
    "inputSchema": {
      "type": "object"
    },
    "outputSchema": {
      "type": [
        "object",
        "null"
      ]
    },
    "operation_id": {
      "type": "integer"
    },
    "api": {
      "type": "string",
      "pattern": "^@[a-z0-9][a-z0-9_-]{0,99}$",
      "example": "@x_com"
    },
    "operation": {
      "type": "string"
    },
    "contract_version": {
      "type": "integer"
    }
  },
  "required": [
    "name",
    "title",
    "description",
    "inputSchema",
    "outputSchema",
    "operation_id",
    "api",
    "operation",
    "contract_version"
  ],
  "additionalProperties": true
}