{
  "openapi": "3.1.0",
  "info": {
    "title": "IAasks Mission API",
    "version": "0.2.0",
    "description": "Submit human-reviewed requests for real-world actions."
  },
  "servers": [
    {
      "url": "https://iaasks.com"
    }
  ],
  "paths": {
    "/api/capabilities": {
      "get": {
        "operationId": "getCapabilities",
        "summary": "Discover IAasks capabilities",
        "responses": {
          "200": {
            "description": "Capability catalog"
          }
        }
      }
    },
    "/api/missions": {
      "post": {
        "operationId": "createMission",
        "summary": "Create a mission request",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "requester_name",
                  "email",
                  "mission_type",
                  "description"
                ],
                "properties": {
                  "requester_name": {
                    "type": "string",
                    "maxLength": 160
                  },
                  "email": {
                    "type": "string",
                    "format": "email",
                    "maxLength": 254
                  },
                  "mission_type": {
                    "type": "string",
                    "enum": [
                      "field_verification",
                      "human_call",
                      "app_testing",
                      "real_world_data",
                      "other"
                    ]
                  },
                  "description": {
                    "type": "string",
                    "minLength": 20,
                    "maxLength": 4000
                  },
                  "location": {
                    "type": "string",
                    "maxLength": 300
                  },
                  "budget": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "deadline": {
                    "type": "string",
                    "maxLength": 120
                  },
                  "source": {
                    "type": "string",
                    "maxLength": 80
                  }
                }
              }
            }
          }
        },
        "responses": {
          "201": {
            "description": "Mission request created",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "id",
                    "status",
                    "tracking_token",
                    "tracking_url",
                    "status_endpoint"
                  ],
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "tracking_token": {
                      "type": "string"
                    },
                    "tracking_url": {
                      "type": "string"
                    },
                    "status_endpoint": {
                      "type": "string"
                    },
                    "created_at": {
                      "type": "string"
                    },
                    "next_step": {
                      "type": "string"
                    },
                    "message": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid request"
          },
          "413": {
            "description": "Payload too large"
          },
          "415": {
            "description": "JSON required"
          },
          "503": {
            "description": "Temporarily unavailable"
          }
        }
      }
    },
    "/api/missions/{id}": {
      "get": {
        "operationId": "getMissionStatus",
        "summary": "Read mission status with its private token",
        "security": [
          {
            "trackingToken": []
          }
        ],
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Status and human-authored public update",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "id": {
                      "type": "string"
                    },
                    "status": {
                      "type": "string"
                    },
                    "public_update": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "created_at": {
                      "type": "integer",
                      "description": "Unix milliseconds"
                    },
                    "updated_at": {
                      "type": [
                        "integer",
                        "null"
                      ]
                    }
                  }
                }
              }
            }
          },
          "401": {
            "description": "Missing token"
          },
          "404": {
            "description": "Unknown mission or wrong token"
          },
          "503": {
            "description": "Temporarily unavailable"
          }
        }
      }
    }
  },
  "components": {
    "securitySchemes": {
      "trackingToken": {
        "type": "http",
        "scheme": "bearer",
        "description": "Private tracking token returned once at creation."
      }
    }
  }
}