{"openapi":"3.0.3","info":{"title":"MightyAutomation Agent API","version":"1.0.0","description":"Project-scoped automation & CRM API. Authenticate every request with `Authorization: Bearer <key>` — keys are minted in the app under Integrations → Zapier (scope `zapier`) or the agent-keys settings (scope `agent`). The project is resolved from the key; there is no project parameter on any route."},"servers":[{"url":"https://mightyautomation.com"}],"components":{"securitySchemes":{"bearer":{"type":"http","scheme":"bearer","bearerFormat":"mva_<scope>_<token>"}},"schemas":{"Contact":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"email":{"type":"string","format":"email"},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"phone":{"type":"string","nullable":true},"company":{"type":"string","nullable":true},"lifecycle":{"type":"string","enum":["lead","prospect","contact","customer","churned"]},"pipeline_stage":{"type":"string","nullable":true},"source":{"type":"string","nullable":true},"tags":{"type":"array","items":{"type":"string"}},"do_not_contact":{"type":"boolean"},"custom":{"type":"object","additionalProperties":true},"physical_address_line1":{"type":"string","nullable":true},"physical_address_line2":{"type":"string","nullable":true},"physical_city":{"type":"string","nullable":true},"physical_state":{"type":"string","nullable":true},"physical_zip":{"type":"string","nullable":true},"mailing_address_line1":{"type":"string","nullable":true},"mailing_address_line2":{"type":"string","nullable":true},"mailing_city":{"type":"string","nullable":true},"mailing_state":{"type":"string","nullable":true},"mailing_zip":{"type":"string","nullable":true},"created_at":{"type":"string","format":"date-time"}}},"AgentEvent":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"type":{"type":"string","description":"contact_created | tag_added | entered_stage | lifecycle_changed | form_submitted | activity_logged | appointment_booked | appointment_rescheduled | appointment_cancelled | appointment_completed | appointment_no_show | call_completed | call_outcome"},"occurred_at":{"type":"string","format":"date-time"},"project_id":{"type":"string","format":"uuid"},"contact_id":{"type":"string","format":"uuid","nullable":true},"contact":{"$ref":"#/components/schemas/Contact"},"data":{"type":"object","additionalProperties":true}}},"ContactUpsert":{"type":"object","required":["email"],"properties":{"email":{"type":"string","format":"email"},"first_name":{"type":"string"},"last_name":{"type":"string"},"phone":{"type":"string"},"company":{"type":"string"},"lifecycle":{"type":"string"},"pipeline_stage":{"type":"string","description":"Must match a stage name from GET /api/agent/pipeline-stages"},"source":{"type":"string"},"tags":{"type":"array","items":{"type":"string"},"description":"Merged, never replaced"},"notes":{"type":"string","description":"Appended to the contact notes"},"physical_address_line1":{"type":"string"},"physical_address_line2":{"type":"string"},"physical_city":{"type":"string"},"physical_state":{"type":"string"},"physical_zip":{"type":"string"},"mailing_address_line1":{"type":"string"},"mailing_address_line2":{"type":"string"},"mailing_city":{"type":"string"},"mailing_state":{"type":"string"},"mailing_zip":{"type":"string"},"custom":{"type":"object","additionalProperties":true}}}}},"security":[{"bearer":[]}],"paths":{"/api/agent/me":{"get":{"summary":"Validate the API key and return the bound project","responses":{"200":{"description":"{ ok, project_id, project_name, key_label, scope }"}}}},"/api/agent/contacts":{"get":{"summary":"List or search contacts (newest first)","parameters":[{"name":"email","in":"query","schema":{"type":"string"},"description":"Case-insensitive email match — contact lookup"},{"name":"created_after","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"limit","in":"query","schema":{"type":"integer","default":100,"maximum":200}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}}],"responses":{"200":{"description":"{ ok, contacts: Contact[] }"}}},"post":{"summary":"Create or update a contact (upsert by email)","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ContactUpsert"}}}},"responses":{"200":{"description":"{ ok, contact_id, created, events }"}}}},"/api/agent/contacts/{id}":{"get":{"summary":"Contact detail + recent activity","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ ok, contact, activities, upcoming_events }"}}},"patch":{"summary":"Update contact fields (stage, lifecycle, tags, phone, names, do_not_contact)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object"}}}},"responses":{"200":{"description":"{ ok, contact }"}}}},"/api/agent/contacts/{id}/notes":{"post":{"summary":"Add a note to the contact timeline","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["content"],"properties":{"content":{"type":"string"}}}}}},"responses":{"200":{"description":"{ ok, note }"}}}},"/api/agent/contacts/tags":{"post":{"summary":"Add tags to a contact (merge; locate by contact_id or email)","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["tags"],"properties":{"contact_id":{"type":"string"},"email":{"type":"string"},"tags":{"type":"array","items":{"type":"string"}}}}}}},"responses":{"200":{"description":"{ ok, contact_id, tags, added }"}}}},"/api/agent/leads":{"get":{"summary":"Lead search with CRM filters (q, stage, lifecycle, has_phone)","parameters":[{"name":"q","in":"query","schema":{"type":"string"}},{"name":"stage","in":"query","schema":{"type":"string"}},{"name":"lifecycle","in":"query","schema":{"type":"string"}},{"name":"has_phone","in":"query","schema":{"type":"string","enum":["true"]}},{"name":"limit","in":"query","schema":{"type":"integer","default":50,"maximum":200}},{"name":"offset","in":"query","schema":{"type":"integer","default":0}}],"responses":{"200":{"description":"{ ok, leads, total }"}}}},"/api/agent/automations":{"get":{"summary":"List the project automations (id, name, status)","responses":{"200":{"description":"{ ok, automations }"}}}},"/api/agent/enroll":{"post":{"summary":"Enroll a contact in an automation","requestBody":{"content":{"application/json":{"schema":{"type":"object","properties":{"automation_id":{"type":"string"},"automation_name":{"type":"string","description":"Alternative: case-insensitive name match"},"contact_id":{"type":"string"},"email":{"type":"string","description":"Alternative: locate the contact by email"}}}}}},"responses":{"200":{"description":"enrollment result"}}}},"/api/agent/pipeline-stages":{"get":{"summary":"Pipeline stage names in board order","responses":{"200":{"description":"{ ok, stages }"}}}},"/api/agent/appointments":{"get":{"summary":"Upcoming appointments (optionally ?from=&to=)","responses":{"200":{"description":"{ ok, appointments }"}}}},"/api/agent/booking-links":{"get":{"summary":"Booking links the project exposes","responses":{"200":{"description":"{ ok, links }"}}}},"/api/agent/events":{"get":{"summary":"Event feed — newest first (Zapier trigger samples / polling)","parameters":[{"name":"type","in":"query","schema":{"type":"string"}},{"name":"since","in":"query","schema":{"type":"string","format":"date-time"}},{"name":"limit","in":"query","schema":{"type":"integer","default":25,"maximum":100}}],"responses":{"200":{"description":"{ ok, events: AgentEvent[] }"}}}},"/api/agent/hooks":{"get":{"summary":"List REST-hook subscriptions","responses":{"200":{"description":"{ ok, subscriptions }"}}},"post":{"summary":"Subscribe a target URL to an event type (Zapier REST-hook subscribe)","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["event_type","target_url"],"properties":{"event_type":{"type":"string","description":"An event type or * for all"},"target_url":{"type":"string","format":"uri"}}}}}},"responses":{"200":{"description":"{ ok, id, event_type, target_url }"}}}},"/api/agent/hooks/{id}":{"delete":{"summary":"Unsubscribe a REST hook (idempotent — Zapier unsubscribe)","parameters":[{"name":"id","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"{ ok: true }"}}}},"/api/agent/files":{"post":{"summary":"Import a remote file (https URL) into Media Assets","requestBody":{"content":{"application/json":{"schema":{"type":"object","required":["url"],"properties":{"url":{"type":"string","format":"uri"},"name":{"type":"string"},"contact_id":{"type":"string","description":"Optional — attaches a note to this contact"}}}}}},"responses":{"200":{"description":"{ ok, asset, url }"}}}},"/api/agent/openapi.json":{"get":{"summary":"This document","responses":{"200":{"description":"OpenAPI 3 spec"}}}}}}