{
  "openapi": "3.1.0",
  "jsonSchemaDialect": "https://json-schema.org/draft/2020-12/schema",
  "info": {
    "title": "The Graph Web Actions",
    "version": "1",
    "summary": "The Actions of the Canonical Representation at /cr, as JSON endpoints.",
    "description": "Generated from src/actions.ts, the same contract the forms on / and the server validation use. On this site the form, the chat and the in-page tools only prepare an Action; a person presses the button. Agents may also call the JSON endpoint directly; a list takes an address only after its owner confirms the emailed link, and no endpoint reveals whether they did."
  },
  "servers": [
    {
      "url": "https://thegraphweb.com"
    }
  ],
  "paths": {
    "/contact": {
      "post": {
        "operationId": "contact",
        "summary": "Send a message to Iban Rios",
        "description": "Stores a message for Iban Rios to read and answer by email; can also ask to join the AISwise waitlist, which the address joins only after its owner confirms an emailed link. Requirement: name and email are required; message is required unless waitlist is true. On this site the form, the chat and the in-page tools only prepare an Action; a person presses the button. Agents may also call the JSON endpoint directly; a list takes an address only after its owner confirms the emailed link, and no endpoint reveals whether they did.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "name": {
                    "type": "string",
                    "title": "Name",
                    "description": "The sender's name.",
                    "maxLength": 200,
                    "pattern": "\\S"
                  },
                  "email": {
                    "type": "string",
                    "title": "Email",
                    "description": "Where the reply goes, and the waitlist link if asked.",
                    "maxLength": 320,
                    "format": "email",
                    "pattern": "^[^\\s@]+@[^\\s@]+$"
                  },
                  "message": {
                    "type": "string",
                    "title": "Message",
                    "description": "The message, up to 2,000 characters.",
                    "maxLength": 2000
                  },
                  "waitlist": {
                    "type": "boolean",
                    "title": "Join the AISwise waitlist",
                    "description": "Ask to hear first if AISwise is offered for other sites. The address joins only after its owner confirms the emailed link; then the message may be empty.",
                    "default": false
                  }
                },
                "required": [
                  "name",
                  "email"
                ],
                "if": {
                  "properties": {
                    "waitlist": {
                      "const": true
                    }
                  },
                  "required": [
                    "waitlist"
                  ]
                },
                "else": {
                  "required": [
                    "message"
                  ],
                  "properties": {
                    "message": {
                      "pattern": "\\S"
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Stored for manual review (no automated reply); with waitlist, a confirmation link was emailed."
          },
          "400": {
            "description": "The body is not JSON, not an object, or has fields that cannot be used (see errors).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is over 16 KiB; nothing was read."
          },
          "429": {
            "description": "Over the per-address limit (5 a minute, 10 a day). Retry after the given seconds.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "description": "The confirmation email could not be sent; nothing was stored. Try again later.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-consent": {
          "humanSubmit": "required",
          "confirmsBy": "email-link"
        },
        "x-status-pollable": false
      }
    },
    "/subscribe": {
      "post": {
        "operationId": "subscribe",
        "summary": "Sign up for news of The Graph Web",
        "description": "Emails a confirmation link to an address; it joins the list for news on how this project develops only after its owner confirms within 48 hours. Requirement: email is required. On this site the form, the chat and the in-page tools only prepare an Action; a person presses the button. Agents may also call the JSON endpoint directly; a list takes an address only after its owner confirms the emailed link, and no endpoint reveals whether they did.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$schema": "https://json-schema.org/draft/2020-12/schema",
                "type": "object",
                "properties": {
                  "email": {
                    "type": "string",
                    "title": "Email",
                    "description": "The address to sign up; it gets the confirmation link.",
                    "maxLength": 320,
                    "format": "email",
                    "pattern": "^[^\\s@]+@[^\\s@]+$"
                  }
                },
                "required": [
                  "email"
                ]
              }
            }
          }
        },
        "responses": {
          "202": {
            "description": "A confirmation link was emailed, or the address was already on the list or got one within the hour: the reply is the same, so it never tells whether an address is on the list.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "const": "confirmation_sent"
                    }
                  },
                  "required": [
                    "status"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "The body is not JSON, not an object, or has fields that cannot be used (see errors).",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          },
          "413": {
            "description": "The body is over 16 KiB; nothing was read."
          },
          "429": {
            "description": "Over the per-address limit (5 a minute, 10 a day). Retry after the given seconds.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            },
            "headers": {
              "Retry-After": {
                "schema": {
                  "type": "integer"
                }
              }
            }
          },
          "503": {
            "description": "The confirmation email could not be sent; nothing was stored. Try again later.",
            "content": {
              "application/problem+json": {
                "schema": {
                  "$ref": "#/components/schemas/Problem"
                }
              }
            }
          }
        },
        "x-consent": {
          "humanSubmit": "required",
          "confirmsBy": "email-link"
        },
        "x-status-pollable": false
      }
    }
  },
  "components": {
    "schemas": {
      "Problem": {
        "type": "object",
        "description": "RFC 9457 problem details. `error` and `problems` are kept from the earlier replies.",
        "properties": {
          "type": {
            "type": "string",
            "const": "about:blank"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "errors": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "pointer": {
                  "type": "string"
                },
                "detail": {
                  "type": "string"
                }
              },
              "required": [
                "pointer",
                "detail"
              ]
            }
          },
          "error": {
            "type": "string",
            "enum": [
              "invalid_json",
              "invalid_body",
              "invalid_fields",
              "rate_limited",
              "email_unavailable"
            ]
          },
          "problems": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "type",
          "title",
          "status",
          "detail",
          "error",
          "problems"
        ]
      }
    }
  }
}
