{
    "openapi": "3.1.0",
    "info": {
        "title": "Team Management API",
        "version": "v1",
        "description": "Read-only REST API for your own team: master data and package, members with role and module rights, the module catalogue, open invitations and the seats."
    },
    "servers": [
        {
            "url": "https://api.flowsuite.one",
            "description": "FlowSuite API"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        }
    ],
    "tags": [
        {
            "name": "team",
            "description": "Team and modules"
        },
        {
            "name": "members",
            "description": "Members"
        },
        {
            "name": "invitations",
            "description": "Invitations and seats"
        }
    ],
    "paths": {
        "/team": {
            "get": {
                "operationId": "team-show",
                "summary": "Get your own team",
                "description": "Returns the team's UUID and name, the owner's UUID, the effective package, the trial state and the short codes of the active modules. During a running trial the package given is the trial's package, not the booked one; the trial block shows this.",
                "tags": [
                    "team"
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "9d2f4c1a-7b3e-4f8a-9c5d-1e6a8b0c2d4f",
                                        "name": "Example Company GmbH",
                                        "owner_uuid": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                                        "package": {
                                            "key": "flow_suite_pro",
                                            "name": "FlowSuite Pro"
                                        },
                                        "trial": {
                                            "active": false,
                                            "ends_at": "2026-08-01T00:00:00+02:00",
                                            "days_remaining": 0,
                                            "package_key": null
                                        },
                                        "active_modules": [
                                            "ai",
                                            "cc",
                                            "tt",
                                            "cm",
                                            "td",
                                            "fs",
                                            "sa",
                                            "fa",
                                            "fe",
                                            "fd",
                                            "flowsupport"
                                        ],
                                        "created_at": "2025-11-02T09:14:00+01:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/team/modules": {
            "get": {
                "operationId": "team-modules",
                "summary": "Get the module catalogue with your own rights",
                "description": "Returns every module with its short code, long code and display name, plus whether the package includes it, whether the team has switched it on, whether it is therefore usable and whether the calling key itself may access it. own_sub_access lists your own sub-rights in the module. For modules outside the packages, such as hosting or team management, package_granted is null.",
                "tags": [
                    "team"
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": [
                                        {
                                            "field": "cm",
                                            "key": "flowcrm",
                                            "label": "FlowCRM",
                                            "group": "flow_suite",
                                            "availability": "package",
                                            "package_granted": true,
                                            "team_active": true,
                                            "available": true,
                                            "own_access": true,
                                            "own_sub_access": [
                                                "kunden",
                                                "projekte"
                                            ]
                                        },
                                        {
                                            "field": "tm",
                                            "key": null,
                                            "label": "Teamverwaltung",
                                            "group": "additional",
                                            "availability": "always",
                                            "package_granted": null,
                                            "team_active": true,
                                            "available": true,
                                            "own_access": false,
                                            "own_sub_access": []
                                        }
                                    ]
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/team/members": {
            "get": {
                "operationId": "team-members-index",
                "summary": "List members",
                "description": "Returns the members of your own team with UUID, name, email address, derived role, free-text title, the module rights as booleans per short code, the stored sub-rights per module and the full access scopes. The module rights take into account that the owner holds every module on offer, even without the flag set.",
                "tags": [
                    "members"
                ],
                "parameters": [
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Items per page, 1 to 200, default 50.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Page number, default 1.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": [
                                        {
                                            "uuid": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                                            "name": "Anna Beispiel",
                                            "email": "anna@example.com",
                                            "role": "manager",
                                            "role_label": "Buchhaltung",
                                            "modules": {
                                                "tt": true,
                                                "cm": true,
                                                "fa": false,
                                                "tm": true
                                            },
                                            "sub_access": {
                                                "flowcrm": [
                                                    "kunden",
                                                    "projekte"
                                                ]
                                            },
                                            "full_access_scopes": [],
                                            "joined_at": "2025-11-02T09:14:00+01:00"
                                        }
                                    ],
                                    "meta": {
                                        "current_page": 1,
                                        "per_page": 50,
                                        "total": 1,
                                        "last_page": 1
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/team/members/{userUuid}": {
            "get": {
                "operationId": "team-members-show",
                "summary": "Get a single member",
                "description": "Returns a single member in the same form as the list. It is addressed by the person's UUID. A UUID that belongs to nobody and one from another team both respond with HTTP 404.",
                "tags": [
                    "members"
                ],
                "parameters": [
                    {
                        "name": "userUuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "uuid": "1a2b3c4d-5e6f-4a7b-8c9d-0e1f2a3b4c5d",
                                        "name": "Anna Beispiel",
                                        "email": "anna@example.com",
                                        "role": "member",
                                        "role_label": null,
                                        "modules": {
                                            "tt": true,
                                            "cm": true
                                        },
                                        "sub_access": {
                                            "flowtime": [
                                                "berichte"
                                            ]
                                        },
                                        "full_access_scopes": [],
                                        "joined_at": "2025-11-02T09:14:00+01:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/team/invitations": {
            "get": {
                "operationId": "team-invitations",
                "summary": "List open invitations",
                "description": "Returns the invitations that still bind an address to this team, with UUID, address, free-text title, state, expiry time and creation time. Expired and already accepted invitations do not appear.",
                "tags": [
                    "invitations"
                ],
                "parameters": [
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Items per page, 1 to 200, default 50.",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "page",
                        "in": "query",
                        "required": false,
                        "description": "Page number, default 1.",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": [
                                        {
                                            "uuid": "7f8e9d0c-1b2a-4c3d-8e5f-6a7b8c9d0e1f",
                                            "email": "neu@example.com",
                                            "role": null,
                                            "status": "pending",
                                            "expires_at": "2026-10-05T12:00:00+02:00",
                                            "created_at": "2026-09-21T12:00:00+02:00"
                                        }
                                    ],
                                    "meta": {
                                        "current_page": 1,
                                        "per_page": 50,
                                        "total": 1,
                                        "last_page": 1
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/team/licenses": {
            "get": {
                "operationId": "team-licenses",
                "summary": "Get seats",
                "description": "Returns the team's seat situation: purchased seats, occupied seats, open invitations, whether another invitation is possible and, for an enterprise contract, its member limit. state is active_subscription, trialing or no_subscription. The information comes from the same check that decides on another invitation in the web interface.",
                "tags": [
                    "invitations"
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "success": true,
                                    "data": {
                                        "state": "active_subscription",
                                        "purchased": 5,
                                        "active": 3,
                                        "pending": 1,
                                        "enterprise_max_members": null,
                                        "can_invite": true,
                                        "enterprise_capped": false,
                                        "billing_cycle": "monthly",
                                        "current_period_end": "2026-10-21T00:00:00+02:00",
                                        "trial_ends_at": "2026-08-01T00:00:00+02:00",
                                        "trial_days_remaining": 0
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "bearerAuth": {
                "type": "http",
                "scheme": "bearer",
                "description": "API key (pk_… or at_…) as Authorization: Bearer <key>. Any other way of sending it is rejected with 401."
            }
        },
        "schemas": {
            "Error": {
                "type": "object",
                "properties": {
                    "success": {
                        "type": "boolean"
                    },
                    "error": {
                        "type": "string"
                    },
                    "message": {
                        "type": "string"
                    },
                    "errors": {
                        "type": "object"
                    }
                }
            }
        }
    }
}