{"openapi":"3.1.0","info":{"title":"Microphone agent API","version":"1.0.0","description":"Talk to Microphone the way a founder does by text, over chat. Sign up with an emailed code, send messages in plain language, and read status and results. Microphone replies with the plan, the price, and a link whenever a person has to pay or approve something."},"servers":[{"url":"https://www.microphone.computer"}],"paths":{"/chat":{"get":{"operationId":"readChat","summary":"Read the conversation, or the getting-started guide when not signed in.","parameters":[{"name":"after","in":"query","schema":{"type":"string"},"description":"A cursor from an earlier call; returns only what came after it."},{"name":"limit","in":"query","schema":{"type":"integer","minimum":1,"maximum":200}}],"responses":{"200":{"description":"Messages, oldest first, or the guide.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Messages"}}}}}},"post":{"operationId":"sendMessage","summary":"Say something to Microphone and wait for its reply.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/SendMessage"}}}},"description":"The first 5 messages are free. After that the account must load its wallet ($20 or more at a time), and each message takes $0.05 from it.","responses":{"200":{"description":"The replies so far.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Reply"}}}},"400":{"description":"The request was not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown API key or session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The free messages are used and the wallet is not loaded, or it is empty. Nothing was run.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"409":{"description":"The intake has not been filled in. The response carries the form. Nothing was run.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many messages. See Retry-After.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/chat/intake":{"get":{"operationId":"getIntake","summary":"The intake questions, and whether this account has answered them.","security":[{"bearer":[]}],"responses":{"200":{"description":"The form and whether it is done.","content":{"application/json":{"schema":{"type":"object","properties":{"completed":{"type":"boolean"},"completed_at":{"type":["string","null"]},"form":{"type":"object"}}}}}},"400":{"description":"The request was not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown API key or session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"submitIntake","summary":"Fill in the intake every customer does before the first message. Free; it is not a message.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/Intake"}}}},"responses":{"200":{"description":"Done, with Microphone's opening reply.","content":{"application/json":{"schema":{"type":"object","properties":{"completed_at":{"type":"string"},"greeting":{"type":"array","items":{"type":"string"}}}}}}},"400":{"description":"The request was not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown API key or session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/chat/status":{"get":{"operationId":"getStatus","summary":"The account's jobs: outcomes asked for and recent tests, and where each stands.","security":[{"bearer":[]}],"responses":{"200":{"description":"Outcomes and tests, newest first.","content":{"application/json":{"schema":{"type":"object","properties":{"outcomes":{"type":"array","items":{"$ref":"#/components/schemas/OutcomeStatus"}},"tests":{"type":"array","items":{"$ref":"#/components/schemas/TestStatus"}}}}}}},"400":{"description":"The request was not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown API key or session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/chat/tests/{id}":{"get":{"operationId":"getTestResult","summary":"One test with what was delivered and measured.","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"The test, its metrics, and its readout once it has ended.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/TestResult"}}}},"400":{"description":"The request was not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown API key or session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"404":{"description":"No such test.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/chat/account":{"get":{"operationId":"getAccount","summary":"The signed-in account, its API keys by prefix, and its wallet.","security":[{"bearer":[]}],"responses":{"200":{"description":"Account, keys and wallet.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Account"}}}},"400":{"description":"The request was not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown API key or session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/chat/account/topup":{"post":{"operationId":"createTopUp","summary":"A checkout link that adds money to the wallet. A person opens it and pays.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["amount_usd"],"properties":{"amount_usd":{"type":"integer","minimum":20,"maximum":1000}}}}}},"responses":{"200":{"description":"The checkout link.","content":{"application/json":{"schema":{"type":"object","properties":{"checkout_url":{"type":"string"},"amount_usd":{"type":"integer"}}}}}},"400":{"description":"The request was not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown API key or session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/chat/account/card":{"get":{"operationId":"getSavedCard","summary":"Whether a card is saved, the monthly limit, and what was charged in the last 30 days.","security":[{"bearer":[]}],"responses":{"200":{"description":"Saved card and limit.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/SavedCard"}}}},"400":{"description":"The request was not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown API key or session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"post":{"operationId":"chargeSavedCard","summary":"Charge the saved card and add the money to the wallet, with no person involved. Works only inside the monthly limit a person set.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["amount_usd"],"properties":{"amount_usd":{"type":"integer","minimum":20,"maximum":1000},"idempotency_key":{"type":"string","description":"Your own key for this charge, so a retry is not charged twice."}}}}}},"responses":{"200":{"description":"Charged.","content":{"application/json":{"schema":{"type":"object","properties":{"charged_usd":{"type":"integer"},"charge_id":{"type":"string"},"remaining_limit_usd":{"type":"integer"}}}}}},"400":{"description":"The request was not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown API key or session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"402":{"description":"The card was not charged.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"No limit set, over the limit, or no card saved.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"put":{"operationId":"configureSavedCard","summary":"Set the monthly limit, or with an empty body get a page to save a card. Needs a console session, not an API key.","security":[{"bearer":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"monthly_limit_usd":{"type":"integer","minimum":0,"maximum":1000}}}}}},"responses":{"200":{"description":"The new limit, or the page to save a card.","content":{"application/json":{"schema":{"type":"object","properties":{"monthly_limit_usd":{"type":"integer"},"save_card_url":{"type":"string"}}}}}},"400":{"description":"The request was not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown API key or session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/chat/account/link":{"post":{"operationId":"linkPersonAccount","summary":"Sign the person up for real, or connect to the Microphone account they already have. Call once with `phone` or `identifier` to send or request a code, then again with the `code`.","security":[{"bearer":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"phone":{"type":"string","description":"The person's US mobile number."},"identifier":{"type":"string","description":"The phone or email on their existing Microphone account."},"ref":{"type":"string","description":"From the first reply, when a code was texted to an existing customer."},"code":{"type":"string","description":"The 6-digit code the person received."},"email":{"type":"string","format":"email","description":"The person's own email, when the intake did not give one."}}}}}},"responses":{"200":{"description":"Either what to do next to get the code, or confirmation that the account is linked.","content":{"application/json":{"schema":{"type":"object","additionalProperties":true}}}},"400":{"description":"The request was not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown API key or session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/chat/account/keys/rotate":{"post":{"operationId":"rotateApiKey","summary":"Swap the API key sent with this request for a new one of the same kind, lasting 15 days. The old key stops working an hour later. Needs the API key itself, not a session.","security":[{"bearer":[]}],"responses":{"200":{"description":"The new key, shown once.","content":{"application/json":{"schema":{"type":"object","properties":{"api_key":{"type":"string"},"expires_at":{"type":["string","null"]},"scope":{"type":"string","enum":["full","read"]},"old_key_works_until":{"type":"string"}}}}}},"400":{"description":"The request was not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown API key or session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/chat/account/keys":{"post":{"operationId":"createApiKey","summary":"Create another API key, or a new one after the last expired. Needs the session a sign-in returns, not an API key.","security":[{"bearer":[]}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"expires_in_days":{"type":"integer","minimum":1,"maximum":15,"default":15},"read_only":{"type":"boolean","description":"A read-only key cannot send a message or move money."}}}}}},"responses":{"200":{"description":"The new key, shown once.","content":{"application/json":{"schema":{"type":"object","properties":{"api_key":{"type":"string"},"expires_at":{"type":["string","null"]},"scope":{"type":"string","enum":["full","read"]}}}}}},"400":{"description":"The request was not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown API key or session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}},"delete":{"operationId":"revokeApiKey","summary":"Revoke one API key. Needs a dashboard session, not an API key.","security":[{"bearer":[]}],"parameters":[{"name":"id","in":"query","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"Revoked.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"}}}}}},"400":{"description":"The request was not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown API key or session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/chat/services":{"get":{"operationId":"listServices","summary":"What Microphone sells and what each costs. No sign-in needed.","responses":{"200":{"description":"Services.","content":{"application/json":{"schema":{"type":"object","properties":{"services":{"type":"array","items":{"$ref":"#/components/schemas/Service"}}}}}}}}}},"/chat/login/start":{"post":{"operationId":"requestLoginCode","summary":"Email a six-digit sign-in code. Signs up a new address and logs in a known one.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"}}}}}},"responses":{"200":{"description":"Code sent.","content":{"application/json":{"schema":{"type":"object","properties":{"ok":{"type":"boolean"},"email":{"type":"string"}}}}}},"400":{"description":"The request was not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown API key or session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"429":{"description":"Too many codes requested.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}},"/chat/login/verify":{"post":{"operationId":"verifyLoginCode","summary":"Verify the code. The first sign-in creates the account and returns its API key once.","requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["email","code"],"properties":{"email":{"type":"string","format":"email"},"code":{"type":"string","pattern":"^\\d{6}$"},"label":{"type":"string","description":"What this agent is."},"api_key":{"type":"boolean","description":"Send false to sign in without creating an API key; the session alone signs requests. Default true."},"separate_account":{"type":"boolean","description":"Send true to make a separate agent account for an email that is already on a customer's own Microphone account. Without it that first sign-in answers 409 with code existing_customer, and the same code can be sent again."}}}}}},"responses":{"200":{"description":"Signed in.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Login"}}}},"400":{"description":"The request was not valid.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"401":{"description":"Missing or unknown API key or session.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}},"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","description":"An agent API key (mic_agent_...), a console session (mic_session_...), or an OAuth access token (mic_oauth_...)."}},"schemas":{"Error":{"type":"object","properties":{"error":{"type":"string"},"code":{"type":"string"}}},"Message":{"type":"object","properties":{"id":{"type":"string"},"from":{"type":"string","enum":["you","microphone"]},"text":{"type":"string"},"created_at":{"type":"string","format":"date-time"}}},"Messages":{"type":"object","properties":{"messages":{"type":"array","items":{"$ref":"#/components/schemas/Message"}},"cursor":{"type":["string","null"]}}},"SendMessage":{"type":"object","required":["text"],"properties":{"text":{"type":"string","maxLength":4000,"description":"What to say, in plain language."},"wait_seconds":{"type":"number","minimum":0,"maximum":120,"default":40,"description":"How long to wait for the reply before returning."}}},"Reply":{"type":"object","properties":{"replies":{"type":"array","items":{"$ref":"#/components/schemas/Message"}},"pending":{"type":"boolean","description":"True when Microphone is still working; read the rest with the cursor."},"cursor":{"type":"string"}}},"OutcomeStatus":{"type":"object","properties":{"id":{"type":"string"},"outcome":{"type":"string","description":"The result asked for."},"success_measure":{"type":["string","null"]},"timeline":{"type":["string","null"]},"status":{"type":"string","enum":["received","in_review","quoted","accepted","closed"]},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}}},"TestStatus":{"type":"object","properties":{"id":{"type":"string"},"idea":{"type":"string"},"status":{"type":"string","enum":["intake","proposed","awaiting_payment","running","done"]},"ad_stage":{"type":["string","null"]},"budget_usd":{"type":["number","null"]},"spent_usd":{"type":"number"},"verdict":{"type":["string","null"]},"checkout_url":{"type":["string","null"],"description":"Where a person pays, while the test is waiting on payment."},"created_at":{"type":"string","format":"date-time"}}},"TestResult":{"type":"object","properties":{"id":{"type":"string"},"idea":{"type":"string"},"status":{"type":"string"},"ad_stage":{"type":["string","null"]},"budget_usd":{"type":["number","null"]},"spent_usd":{"type":"number"},"created_at":{"type":"string","format":"date-time"},"finished_at":{"type":["string","null"]},"metrics":{"type":["object","null"],"description":"Impressions, clicks, spend in cents, click rate, signups and the verdict so far."},"readout":{"type":["object","null"],"description":"What worked, what did not, why, the verdict and its confidence, and the learnings with their evidence."},"ad_launch_id":{"type":["string","null"]}}},"Account":{"type":"object","properties":{"account":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"email":{"type":["string","null"]}}},"note":{"type":"string","description":"Present when this agent account's email is also on a Microphone account the person texts with: what to tell them about signing in to that account instead."},"keys":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string"},"prefix":{"type":"string"},"created_at":{"type":"string"},"last_used_at":{"type":["string","null"]}}}},"wallet":{"type":"object","properties":{"available_usd":{"type":["number","null"]},"reserved_usd":{"type":"number"}}}}},"Intake":{"type":"object","required":["first_name","path"],"properties":{"first_name":{"type":"string","description":"The first name of the person the agent acts for."},"last_name":{"type":"string"},"phone":{"type":"string","description":"Optional: the person's US mobile number, to sign them up for real. The reply says how they prove it; finish with linkPersonAccount."},"path":{"type":"string","enum":["outcome","self_serve"]},"outcome_wanted":{"type":"string","description":"Required for path outcome: the result and how it is verified."},"email":{"type":"string","format":"email","description":"Required for path outcome: the email address of the person the agent acts for, where the quote is sent."},"outcome_deadline":{"type":"string","description":"Required for path outcome: when the result is needed by, such as \"by March 1\", \"within 6 weeks\" or \"no deadline\". The quote depends on it."},"outcome_budget":{"type":"string"},"founder_stage":{"type":"string","enum":["exploring","side_project","live_business","smb","questions"],"description":"Required for path self_serve."},"focus":{"type":"string","description":"The idea to test, or for smb what the business does."},"question":{"type":"string"},"customers":{"type":"string","enum":["local","b2b","online"],"description":"Required for founder_stage smb."},"business_name":{"type":"string"},"business_website":{"type":"string"},"business_city":{"type":"string","description":"Required when customers is local."},"want_more_of":{"type":"string","enum":["bookings","calls","consults","visits","demos","trials","sales","leads"]}}},"SavedCard":{"type":"object","properties":{"card":{"type":["object","null"],"properties":{"brand":{"type":"string"},"last4":{"type":"string"}}},"monthly_limit_usd":{"type":"integer"},"charged_last_30_days_usd":{"type":"integer"}}},"Service":{"type":"object","properties":{"id":{"type":"string"},"name":{"type":"string"},"what":{"type":"string"},"price":{"type":"string"},"how_to_start":{"type":"string"}}},"Login":{"type":"object","properties":{"session":{"type":"string"},"created":{"type":"boolean"},"existing_customer":{"type":"boolean","description":"True when the email is also on a customer's own Microphone account, which is signed in to separately and has its own history, wallet and plan."},"api_key":{"type":["string","null"],"description":"Present only on the first sign-in, unless the request said `api_key: false`. Store it; it is never shown again."},"api_key_expires_at":{"type":["string","null"],"description":"When that key stops working. Swap it for a new one before then with rotateApiKey. If it has run out, sign in again and call createApiKey with the session as the bearer token."},"account":{"type":"object","properties":{"id":{"type":"string"},"label":{"type":"string"},"email":{"type":["string","null"]}}},"note":{"type":"string","description":"Present when this agent account's email is also on a Microphone account the person texts with: what to tell them about signing in to that account instead."}}}}}}