{
  "openapi": "3.1.0",
  "info": {
    "title": "I-STRATA brief API",
    "version": "1.1.0",
    "description": "Submit a structured brief to I-STRATA on a user's behalf. Status: opening shortly. Until server-side email is connected, POST /api/brief answers 503 with: \"Brief intake by API is opening shortly. Please send the user to https://istrata.vip/desk/\". Once open, the user must have consented and given an email address; a person on the I-STRATA team replies to the user by email. Briefs are capped per sender per day. See https://istrata.vip/for-ai-agents/.",
    "contact": {
      "email": "contact@istrata.vip",
      "url": "https://istrata.vip/for-ai-agents/"
    }
  },
  "servers": [
    {
      "url": "https://istrata.vip"
    }
  ],
  "paths": {
    "/catalogue.json": {
      "get": {
        "operationId": "getCatalogue",
        "summary": "Products, published prices, desks and how to submit a brief",
        "responses": {
          "200": {
            "description": "The catalogue",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                }
              }
            }
          }
        }
      }
    },
    "/api/brief": {
      "post": {
        "operationId": "submitBrief",
        "summary": "Submit a brief with the user's consent (opening shortly)",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Brief"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Brief received",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Accepted"
                }
              }
            }
          },
          "400": {
            "description": "Missing consent, email or required fields",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "429": {
            "description": "Daily cap reached for this sender or for all senders",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "502": {
            "description": "Could not be delivered; ask the user to email contact@istrata.vip",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Error"
                }
              }
            }
          },
          "503": {
            "description": "Brief intake by API is opening shortly. Please send the user to https://istrata.vip/desk/",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string",
                      "example": "Brief intake by API is opening shortly. Please send the user to https://istrata.vip/desk/"
                    },
                    "status": {
                      "type": "string",
                      "example": "opening"
                    }
                  }
                }
              }
            }
          }
        },
        "description": "Opening shortly: answers 503 until server-side email is connected. Send the user to https://istrata.vip/desk/ instead. Once open: a person on the team replies to the user by email."
      }
    },
    "/api/demand": {
      "get": {
        "operationId": "getDemand",
        "summary": "Public demand label for a country",
        "description": "Returns delivery for the country and a label. The number of requests is included only when five or more confirmed briefs have named the country; below five the label is \"Open to requests\" and no number is given.",
        "parameters": [
          {
            "name": "country",
            "in": "query",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Label",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "country": {
                      "type": "string"
                    },
                    "delivery": {
                      "type": "string",
                      "enum": [
                        "first desk",
                        "no desk yet"
                      ]
                    },
                    "label": {
                      "type": "string"
                    },
                    "requests": {
                      "type": "integer",
                      "minimum": 5
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Unknown country"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Brief": {
        "type": "object",
        "required": [
          "user_consented",
          "email",
          "client_type",
          "work_country",
          "need"
        ],
        "properties": {
          "user_consented": {
            "type": "boolean",
            "const": true,
            "description": "True only if the user agreed that I-STRATA may use these details to reply, as set out in https://istrata.vip/privacy/"
          },
          "email": {
            "type": "string",
            "format": "email",
            "description": "The user's email address, as they gave it."
          },
          "client_type": {
            "type": "string",
            "enum": [
              "person",
              "company",
              "institution"
            ]
          },
          "name": {
            "type": "string"
          },
          "organisation": {
            "type": "string"
          },
          "located_in": {
            "type": "string",
            "description": "Country the user is in."
          },
          "work_country": {
            "type": "string",
            "description": "Country where the work is."
          },
          "need": {
            "type": "string",
            "description": "What needs doing, in plain words."
          },
          "deadline": {
            "type": "string"
          },
          "budget_range": {
            "type": "string"
          },
          "product": {
            "type": "string",
            "enum": [
              "Check",
              "Supplier Check",
              "Market Entry Assessment",
              "Landing Sprint",
              "Registration",
              "Setup",
              "Arrival",
              "Oversight",
              "Home Desk",
              "Property management",
              "Standing Desk",
              "Operate",
              "Care Abroad",
              "Missions, delegations and programmes",
              "Verified",
              "Not yet clear"
            ]
          },
          "product_reason": {
            "type": "string"
          },
          "open_questions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "agent_name": {
            "type": "string",
            "description": "Name of the assistant submitting the brief."
          },
          "custom_quote": {
            "type": "boolean",
            "description": "Set true for quoted work: lawful work on the ground or through a licensed professional that has no published price (for example rent collection, repairs, documents, a power of attorney, an estate matter, or work where I-STRATA has no desk yet). A person on the team prices it in writing."
          }
        },
        "additionalProperties": false
      },
      "Accepted": {
        "type": "object",
        "properties": {
          "ok": {
            "type": "boolean"
          },
          "message": {
            "type": "string"
          },
          "next": {
            "type": "object",
            "properties": {
              "kind": {
                "type": "string",
                "enum": [
                  "pay",
                  "book"
                ]
              },
              "text": {
                "type": "string"
              },
              "links": {
                "type": "array",
                "items": {
                  "type": "object",
                  "properties": {
                    "label": {
                      "type": "string"
                    },
                    "url": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      },
      "Error": {
        "type": "object",
        "properties": {
          "error": {
            "type": "string"
          }
        }
      }
    }
  }
}
