{
  "openapi": "3.1.0",
  "info": {
    "title": "Time Machine Automation agent inquiry",
    "version": "1.0.0",
    "summary": "Send a short inquiry to Time Machine Automation on behalf of a person.",
    "description": "An agent acting for a person can send a short inquiry to Time Machine Automation (TMA). Inquiries are accepted on the person's behalf and with their agreement, recorded as consent_to_contact set to true. The reply is a receipt, example ideas for the selected task categories, and questions that help the person think it through. The reply does not repeat anything that was submitted, and no model is involved in producing it. A person at TMA reads each inquiry. The same file also describes /api/submit-form, the endpoint behind the form for people. A human readable version of this description is at https://www.timemachineautomation.com/agents and https://www.timemachineautomation.com/agents.md.",
    "contact": {
      "name": "Time Machine Automation",
      "url": "https://www.timemachineautomation.com/#book"
    }
  },
  "servers": [
    {
      "url": "https://www.timemachineautomation.com"
    }
  ],
  "paths": {
    "/api/agent-inquiry": {
      "post": {
        "operationId": "sendAgentInquiry",
        "summary": "Send an inquiry for a person",
        "description": "Requests are JSON, at most 4096 bytes, with unknown fields rejected. Angle brackets and control characters are removed from text. Requests are rate limited per client address and across the site. Signature-Agent, Signature, and Signature-Input headers (Web Bot Auth) are noted when present. They are not verified yet and do not change how an inquiry is handled.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InquiryRequest"
              },
              "example": {
                "contact": {
                  "name": "Alex Rivera",
                  "email": "alex@example.com",
                  "company": "Example Accounting",
                  "website": "https://example.com"
                },
                "business": {
                  "summary": "A small accounting office where most of the week goes to chasing documents from clients and retyping figures into spreadsheets.",
                  "team_size": "11-50",
                  "industry": "Accounting"
                },
                "tasks": [
                  "document_processing",
                  "data_entry"
                ],
                "agent": {
                  "name": "Example Assistant",
                  "operator": "Example Co"
                },
                "consent_to_contact": true
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Received. Nothing from the request is repeated in the body.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/InquiryResponse"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input. Lists the field paths that failed, never the values.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "fields": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Field paths that failed validation. Never values."
                    }
                  }
                }
              }
            }
          },
          "405": {
            "description": "Only POST is accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 4096 bytes.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "The request is not application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many inquiries from this address or across the site for now.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable. Nothing was stored.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/submit-form": {
      "post": {
        "operationId": "submitWebsiteForm",
        "summary": "Send the homepage form",
        "description": "The endpoint behind the form for people: the form titled \"Tell us what you want your AI employee to work on.\" at /#book on the homepage, the only form on the site. A browser agent that fills that form for a person, with that person's consent, causes the same request. Requests are JSON, at most 32768 bytes, with unknown fields rejected. Requests are rate limited. A person at Time Machine Automation reads each message and replies by email.",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/FormSubmission"
              },
              "example": {
                "submission_type": "contact",
                "first_name": "Alex",
                "last_name": "Rivera",
                "email": "alex@example.com",
                "phone": "+14125550100",
                "company": "Example Accounting",
                "message": "Most of our week goes to chasing documents from clients and retyping figures into spreadsheets."
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Sent. Nothing from the request is repeated in the body.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "success"
                  ],
                  "properties": {
                    "success": {
                      "const": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input. Lists the field paths that failed, never the values.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    },
                    "fields": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Field paths that failed validation. Never values."
                    }
                  }
                }
              }
            }
          },
          "405": {
            "description": "Only POST is accepted.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "The body is larger than 32768 bytes.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "415": {
            "description": "The request is not application/json.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "429": {
            "description": "Too many requests from this address or across the site for now. A Retry-After header gives the wait in seconds.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Temporarily unavailable. The message was not sent.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "required": [
                    "error"
                  ],
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "TaskCategory": {
        "type": "string",
        "enum": [
          "inbox_and_email",
          "scheduling",
          "customer_service",
          "sales_follow_up",
          "lead_research",
          "invoicing_and_billing",
          "collections",
          "purchasing_and_inventory",
          "onboarding",
          "hiring",
          "data_entry",
          "document_processing",
          "reporting",
          "compliance_and_licensing"
        ]
      },
      "InquiryRequest": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "contact",
          "business",
          "tasks",
          "consent_to_contact"
        ],
        "properties": {
          "contact": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "name",
              "email",
              "company"
            ],
            "properties": {
              "name": {
                "type": "string",
                "minLength": 1,
                "maxLength": 100,
                "description": "The person's name."
              },
              "email": {
                "type": "string",
                "format": "email",
                "maxLength": 254,
                "description": "Where TMA replies."
              },
              "company": {
                "type": "string",
                "minLength": 1,
                "maxLength": 200,
                "description": "The business."
              },
              "website": {
                "type": "string",
                "format": "uri",
                "maxLength": 200,
                "pattern": "^https?://",
                "description": "The business website."
              },
              "phone": {
                "type": "string",
                "maxLength": 30,
                "description": "A phone number with 7 to 15 digits."
              }
            }
          },
          "business": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "summary"
            ],
            "properties": {
              "summary": {
                "type": "string",
                "minLength": 20,
                "maxLength": 1000,
                "description": "What the business does and where the work piles up."
              },
              "team_size": {
                "type": "string",
                "enum": [
                  "1-10",
                  "11-50",
                  "51-200",
                  "201-1000",
                  "1000+"
                ]
              },
              "industry": {
                "type": "string",
                "maxLength": 80
              }
            }
          },
          "tasks": {
            "type": "array",
            "minItems": 1,
            "maxItems": 8,
            "items": {
              "$ref": "#/components/schemas/TaskCategory"
            },
            "description": "Which kinds of work are in question."
          },
          "tasks_other": {
            "type": "string",
            "maxLength": 300,
            "description": "Anything the categories miss."
          },
          "agent": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
              "name": {
                "type": "string",
                "maxLength": 60,
                "description": "The agent or assistant sending the inquiry."
              },
              "operator": {
                "type": "string",
                "maxLength": 60,
                "description": "The company that operates the agent."
              }
            }
          },
          "consent_to_contact": {
            "const": true,
            "description": "The person has agreed to be contacted. Must be true."
          }
        }
      },
      "InquiryResponse": {
        "type": "object",
        "required": [
          "receipt_id",
          "status",
          "next_step",
          "ideas",
          "questions_for_the_person"
        ],
        "properties": {
          "receipt_id": {
            "type": "string",
            "format": "uuid"
          },
          "status": {
            "const": "received"
          },
          "next_step": {
            "type": "string",
            "const": "A person at Time Machine Automation reviews every inquiry and follows up by email."
          },
          "ideas": {
            "type": "array",
            "description": "Fixed example ideas for the selected task categories.",
            "items": {
              "type": "object",
              "required": [
                "category",
                "label",
                "ideas"
              ],
              "properties": {
                "category": {
                  "$ref": "#/components/schemas/TaskCategory"
                },
                "label": {
                  "type": "string"
                },
                "ideas": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "required": [
                      "title",
                      "description"
                    ],
                    "properties": {
                      "title": {
                        "type": "string"
                      },
                      "description": {
                        "type": "string"
                      }
                    }
                  }
                }
              }
            }
          },
          "questions_for_the_person": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Questions that help the person decide whether and where to automate."
          }
        }
      },
      "FormSubmission": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "email",
          "phone"
        ],
        "properties": {
          "submission_type": {
            "type": "string",
            "enum": [
              "contact",
              "pilot"
            ],
            "default": "contact",
            "description": "The website form always sends contact."
          },
          "first_name": {
            "type": "string",
            "maxLength": 100,
            "default": ""
          },
          "last_name": {
            "type": "string",
            "maxLength": 100,
            "default": ""
          },
          "email": {
            "type": "string",
            "format": "email",
            "maxLength": 255,
            "description": "Where TMA replies."
          },
          "phone": {
            "type": "string",
            "pattern": "^\\+1[2-9]\\d{9}$",
            "description": "A US phone number: +1 followed by 10 digits, the first of them 2 through 9, for example +14125550100. Spaces, dashes, dots, and parentheses are removed before the check. Numbers outside the US are rejected."
          },
          "message": {
            "type": "string",
            "maxLength": 5000,
            "default": "",
            "description": "Up to 5000 characters. The homepage form labels this field Message."
          },
          "company": {
            "type": "string",
            "maxLength": 200,
            "description": "Sent by the homepage form."
          },
          "services": {
            "type": "array",
            "maxItems": 20,
            "items": {
              "type": "string",
              "maxLength": 100
            }
          }
        }
      }
    }
  }
}
