{"openapi":"3.0.3","info":{"title":"Inspira Public API","description":"Public API for programmatic access to Inspira. Create an API key on the /api-keys page in the app and send it as a Bearer token.","version":"0.0.686"},"servers":[{"url":"https://api.smartbench.net/api"}],"paths":{"/v1/organizations":{"post":{"operationId":"publicApi-createOrganization","summary":"Create an organization","description":"Create a new organization in the company that owns the API key. Accepts organization fields only — create external stakeholders via POST /v1/stakeholders.","tags":["Public API v1"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"name":{"type":"string","minLength":2,"description":"Organization name."},"phone":{"type":"string"},"address":{"type":"string"},"city":{"type":"string"},"state":{"type":"string"},"zip":{"type":"string"},"country":{"type":"string"},"website":{"type":"string"},"idempotency_key":{"type":"string","minLength":1,"maxLength":255,"nullable":true}},"required":["name"],"additionalProperties":false}}}},"parameters":[{"name":"Authorization","in":"header","required":true,"description":"Bearer <api key> — create one on the /api-keys page.","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"number"},"name":{"type":"string"},"is_active":{"type":"boolean","nullable":true}},"required":["id","name","is_active"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/v1/stakeholders":{"post":{"operationId":"publicApi-createStakeholder","summary":"Create an external stakeholder","description":"Create an external stakeholder (organization contact) under an organization owned by the API key's company. The contact role and account type are fixed server-side; they cannot be set by the caller.","tags":["Public API v1"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"organization_id":{"type":"integer","exclusiveMinimum":true,"minimum":0,"description":"Water organization id."},"first_name":{"type":"string","minLength":1},"last_name":{"type":"string","minLength":1},"email":{"type":"string","format":"email"},"phone":{"type":"string"},"country_code":{"type":"string","nullable":true},"is_primary":{"type":"boolean","default":false,"description":"Mark this contact as the organization's primary contact."}},"required":["organization_id","first_name","last_name","email"],"additionalProperties":false}}}},"parameters":[{"name":"Authorization","in":"header","required":true,"description":"Bearer <api key> — create one on the /api-keys page.","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"number"},"email":{"type":"string"},"first_name":{"type":"string","nullable":true},"last_name":{"type":"string","nullable":true},"org_id":{"type":"number","nullable":true}},"required":["id","email","first_name","last_name","org_id"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/v1/organizations.deactivate":{"post":{"operationId":"publicApi-deactivateOrganization","summary":"Deactivate an organization","description":"Deactivate an organization (and its users) owned by the API key's company. The organization's Auth0 accounts are blocked.","tags":["Public API v1"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","exclusiveMinimum":true,"minimum":0,"description":"Water organization id."}},"required":["id"],"additionalProperties":false}}}},"parameters":[{"name":"Authorization","in":"header","required":true,"description":"Bearer <api key> — create one on the /api-keys page.","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"success":{"type":"boolean"}},"required":["success"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/v1/projects.copy":{"post":{"operationId":"publicApi-copyProject","summary":"Copy a project","description":"Copy a project, optionally into another organization owned by the API key's company. All existing copy rules apply unchanged.","tags":["Public API v1"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"integer","exclusiveMinimum":true,"minimum":0,"description":"Source project id to copy."},"target_org_id":{"type":"integer","exclusiveMinimum":true,"minimum":0,"description":"Destination organization id. Omit to copy within the source's organization."}},"required":["id"],"additionalProperties":false}}}},"parameters":[{"name":"Authorization","in":"header","required":true,"description":"Bearer <api key> — create one on the /api-keys page.","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"number"},"name":{"type":"string","nullable":true},"container_id":{"type":"number","nullable":true}},"required":["id","name","container_id"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/v1/taskActions.create":{"post":{"operationId":"publicApi-createTaskAction","summary":"Create a task","description":"Create a task (action item) under an existing milestone in the company that owns the API key. Requires an assignee and an assignor (each by id or email, resolved to a member of the company). Creation is idempotent on (milestone_id, task_name). With an idempotency_key, only a live task with the same name and assignee (or the same key) counts: a Cancelled, Completed, Closed with no action or deleted task is skipped and a new one is created.","tags":["Public API v1"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"milestone_id":{"type":"integer","exclusiveMinimum":true,"minimum":0,"description":"Existing Water milestone id (a tasks.id) to create the task under. No milestone is created; it must already exist in the key's company."},"task_name":{"type":"string","minLength":1,"maxLength":255,"description":"Task title. Creation is idempotent on (milestone_id, task_name): a task with the same name under the same milestone returns the existing one instead of creating a duplicate. With an idempotency_key, only a live task with the same name AND assignee matches; a Cancelled, Completed, Closed with no action or deleted one is skipped and a new task is created. Include lead-identifying info (e.g. \"Follow up: Jane Doe (lead 4821)\") so distinct events create distinct tasks."},"assignee_id":{"type":"integer","exclusiveMinimum":true,"minimum":0,"description":"User id of the assignee. Supply exactly one of assignee_id / assignee_email."},"assignee_email":{"type":"string","format":"email","description":"Email of the assignee (must be an active member of the key's company). Supply exactly one of assignee_id / assignee_email."},"assignor_id":{"type":"integer","exclusiveMinimum":true,"minimum":0,"description":"User id of the assignor. Supply exactly one of assignor_id / assignor_email."},"assignor_email":{"type":"string","format":"email","description":"Email of the assignor (must be an active member of the key's company, and a system admin OR have access to the milestone). Supply exactly one of assignor_id / assignor_email."},"comment":{"type":"string","maxLength":50000,"description":"Optional opening comment seeded on the task (e.g. lead details)."},"sensitive_data_confirmation":{"type":"boolean","description":"Set true to acknowledge the comment intentionally contains contact info (phone, etc.) so the sensitive-data guard does not reject the request."},"status_id":{"type":"integer","exclusiveMinimum":true,"minimum":0,"description":"Task status id. Defaults to the Active status when omitted."},"idempotency_key":{"type":"string","minLength":1,"maxLength":255,"nullable":true,"description":"Optional retry key (e.g. the CRM lead id). Secondary dedup on (milestone_id, idempotency_key), applied after the task_name match. With a key, the task_name match also needs the same assignee, and only a live task matches (by name or key): a Cancelled, Completed, Closed with no action or deleted task is skipped and a new task is created."}},"required":["milestone_id","task_name"],"additionalProperties":false}}}},"parameters":[{"name":"Authorization","in":"header","required":true,"description":"Bearer <api key> — create one on the /api-keys page.","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"id":{"type":"number"},"task_id":{"type":"number"},"name":{"type":"string"},"assignee_id":{"type":"number","nullable":true},"assignor_id":{"type":"number","nullable":true},"status_id":{"type":"number","nullable":true}},"required":["id","task_id","name","assignee_id","assignor_id","status_id"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}},"/v1/timeSlots.search":{"post":{"operationId":"publicApi-searchTimeSlots","summary":"Search time slots","description":"Search time tracking slots within the API key's company. At least one entity-scoping filter (project_id, task_id, task_action_id, user_id, or container_id) is required; date/status filters alone are not sufficient. Results are paginated (cursor-based, keyed on id). Users with only the default read permission see their own slots; company-level read grants access to all users' slots.","tags":["Public API v1"],"security":[{"Authorization":[]}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","properties":{"project_id":{"type":"integer","exclusiveMinimum":true,"minimum":0,"description":"Filter by project id."},"task_id":{"type":"integer","exclusiveMinimum":true,"minimum":0,"description":"Filter by milestone id (tasks.id)."},"task_action_id":{"type":"integer","exclusiveMinimum":true,"minimum":0,"description":"Filter by task action id (action item)."},"user_id":{"type":"integer","exclusiveMinimum":true,"minimum":0,"description":"Filter by user id."},"container_id":{"type":"integer","exclusiveMinimum":true,"minimum":0,"description":"Filter by organization id (project_containers.id)."},"start_date":{"type":"string","format":"date-time","nullable":true,"description":"Return slots whose start_time is >= this date."},"end_date":{"type":"string","format":"date-time","nullable":true,"description":"Return slots whose start_time is < this date."},"is_active":{"type":"boolean","description":"Filter by active/inactive status."},"limit":{"type":"integer","exclusiveMinimum":true,"minimum":0,"maximum":500,"default":100,"description":"Page size (1–500, default 100)."},"cursor":{"type":"integer","exclusiveMinimum":true,"minimum":0,"description":"Pagination cursor — pass the next_cursor from the previous response."}},"additionalProperties":false}}}},"parameters":[{"name":"Authorization","in":"header","required":true,"description":"Bearer <api key> — create one on the /api-keys page.","schema":{"type":"string"}}],"responses":{"200":{"description":"Successful response","content":{"application/json":{"schema":{"type":"object","properties":{"items":{"type":"array","items":{"type":"object","properties":{"id":{"type":"number"},"user_id":{"type":"number","nullable":true},"project_id":{"type":"number","nullable":true},"task_id":{"type":"number","nullable":true},"task_action_id":{"type":"number","nullable":true},"container_id":{"type":"number","nullable":true},"start_time":{"type":"string","format":"date-time"},"stop_time":{"type":"string","format":"date-time","nullable":true},"is_active":{"type":"boolean"},"is_manual":{"type":"boolean"}},"required":["id","user_id","project_id","task_id","task_action_id","container_id","start_time","stop_time","is_active","is_manual"],"additionalProperties":false}},"next_cursor":{"type":"number","nullable":true}},"required":["items","next_cursor"],"additionalProperties":false}}}},"default":{"$ref":"#/components/responses/error"}}}}},"components":{"responses":{"error":{"description":"Error response","content":{"application/json":{"schema":{"type":"object","properties":{"message":{"type":"string"},"code":{"type":"string"},"issues":{"type":"array","items":{"type":"object","properties":{"message":{"type":"string"}},"required":["message"],"additionalProperties":false}}},"required":["message","code"],"additionalProperties":false}}}}},"securitySchemes":{"Authorization":{"type":"http","scheme":"bearer"}},"schemas":{}}}