{
    "openapi": "3.1.0",
    "info": {
        "title": "FlowContacts API",
        "version": "v1",
        "description": "REST API for managing private contacts, timeline entries and personal details. For integrations, data synchronisation and custom relationship management tools."
    },
    "servers": [
        {
            "url": "https://api.flowsuite.one",
            "description": "FlowSuite API"
        }
    ],
    "security": [
        {
            "bearerAuth": []
        }
    ],
    "tags": [
        {
            "name": "endpoints",
            "description": "API reference"
        }
    ],
    "paths": {
        "/flowcontacts/contacts": {
            "get": {
                "operationId": "contacts-list",
                "summary": "List contacts",
                "description": "Retrieves a list of your personal contacts. The response includes all linked data such as email addresses, phone numbers and postal addresses.",
                "tags": [
                    "endpoints"
                ],
                "parameters": [
                    {
                        "name": "status",
                        "in": "query",
                        "required": false,
                        "description": "Filter by status: active, archived, all",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "required": false,
                        "description": "Search term (name, company, job, email)",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "required": false,
                        "description": "Number of results (max 200)",
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "data": [
                                        {
                                            "uuid": "123e4567-e89b-12d3-a456-426614174000",
                                            "id": 1042,
                                            "first_name": "Max",
                                            "last_name": "Doe",
                                            "company": "Firma GmbH",
                                            "job_title": null,
                                            "notes": null,
                                            "birthday": null,
                                            "avatar_url": null,
                                            "avatar_sha1": null,
                                            "is_shared": false,
                                            "is_own": true,
                                            "status": "active",
                                            "emails": [
                                                {
                                                    "label": "Privat",
                                                    "address": "max@example.com",
                                                    "is_primary": true
                                                }
                                            ],
                                            "phones": [],
                                            "addresses": [],
                                            "created_at": "2026-07-21T10:00:00+00:00",
                                            "updated_at": "2026-07-21T10:00:00+00:00"
                                        }
                                    ],
                                    "meta": {
                                        "current_page": 1,
                                        "per_page": 15,
                                        "total": 42
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "post": {
                "operationId": "contact-create",
                "summary": "Create a contact",
                "description": "Creates a new private contact. Breaking change: the former upsert behaviour via a uuid in the body no longer exists; updates go through PUT /flowcontacts/contacts/{uuid}.",
                "tags": [
                    "endpoints"
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "data": {
                                        "uuid": "223e4567-e89b-12d3-a456-426614174111",
                                        "id": 1043,
                                        "first_name": "Erika",
                                        "last_name": "Doe",
                                        "company": null,
                                        "job_title": "Designerin",
                                        "notes": null,
                                        "birthday": null,
                                        "avatar_url": null,
                                        "avatar_sha1": null,
                                        "is_shared": false,
                                        "is_own": true,
                                        "status": "active",
                                        "emails": [
                                            {
                                                "label": "Geschäftlich",
                                                "address": "erika@example.com",
                                                "is_primary": true
                                            }
                                        ],
                                        "phones": [],
                                        "addresses": [],
                                        "created_at": "2026-07-21T10:00:00+00:00",
                                        "updated_at": "2026-07-21T10:00:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "first_name": {
                                        "type": "string",
                                        "description": "First name"
                                    },
                                    "last_name": {
                                        "type": "string",
                                        "description": "Last name"
                                    },
                                    "company": {
                                        "type": "string",
                                        "description": "Company"
                                    },
                                    "job_title": {
                                        "type": "string",
                                        "description": "Job title"
                                    },
                                    "email_addresses": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Array of email objects with label, address and is_primary"
                                    },
                                    "phone_numbers": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Array of phone objects with label, number and is_primary"
                                    }
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowcontacts/contacts/{uuid}": {
            "get": {
                "operationId": "contact-detail",
                "summary": "Retrieve contact details",
                "description": "Retrieves the full details of a single contact, including email addresses, phone numbers and postal addresses. The recommended way is to address the contact by UUID. As a transition, the numeric ID is accepted as well (/flowcontacts/contacts/123); this form is deprecated and will be removed once the FlowContacts app has fully switched to UUIDs. New integrations must use UUIDs only. Besides uuid, the response temporarily contains the id field again; nested objects (email addresses, phone numbers, postal addresses) still carry no IDs.",
                "tags": [
                    "endpoints"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "data": {
                                        "uuid": "123e4567-e89b-12d3-a456-426614174000",
                                        "id": 1042,
                                        "first_name": "Max",
                                        "last_name": "Doe",
                                        "company": "Firma GmbH",
                                        "job_title": null,
                                        "notes": null,
                                        "birthday": null,
                                        "avatar_url": null,
                                        "avatar_sha1": null,
                                        "is_shared": false,
                                        "is_own": true,
                                        "status": "active",
                                        "emails": [
                                            {
                                                "label": "Privat",
                                                "address": "max@example.com",
                                                "is_primary": true
                                            }
                                        ],
                                        "phones": [],
                                        "addresses": [],
                                        "created_at": "2026-07-21T10:00:00+00:00",
                                        "updated_at": "2026-07-21T10:00:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "put": {
                "operationId": "contact-update",
                "summary": "Update a contact",
                "description": "Updates an existing contact by UUID (partial update: only the fields you send are written). As a transition, the numeric ID is also accepted in the path; this form is deprecated and will be removed. An unknown path value, or one that belongs to someone else, returns HTTP 404 in both forms.",
                "tags": [
                    "endpoints"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "data": {
                                        "uuid": "223e4567-e89b-12d3-a456-426614174111",
                                        "id": 1043,
                                        "first_name": "Erika",
                                        "last_name": "Doe",
                                        "company": "Muster Design",
                                        "job_title": "Designerin",
                                        "notes": null,
                                        "birthday": null,
                                        "avatar_url": null,
                                        "avatar_sha1": null,
                                        "is_shared": false,
                                        "is_own": true,
                                        "status": "active",
                                        "emails": [
                                            {
                                                "label": "Geschäftlich",
                                                "address": "erika@example.com",
                                                "is_primary": true
                                            }
                                        ],
                                        "phones": [],
                                        "addresses": [],
                                        "created_at": "2026-07-21T10:00:00+00:00",
                                        "updated_at": "2026-07-21T11:00:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": false,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "first_name": {
                                        "type": "string",
                                        "description": "First name"
                                    },
                                    "last_name": {
                                        "type": "string",
                                        "description": "Last name"
                                    },
                                    "company": {
                                        "type": "string",
                                        "description": "Company"
                                    },
                                    "job_title": {
                                        "type": "string",
                                        "description": "Job title"
                                    },
                                    "email_addresses": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Array of email objects with label, address and is_primary"
                                    },
                                    "phone_numbers": {
                                        "type": "array",
                                        "items": [],
                                        "description": "Array of phone objects with label, number and is_primary"
                                    }
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "contact-delete",
                "summary": "Delete a contact",
                "description": "Deletes a contact by UUID (soft delete). As a transition, the numeric ID is also accepted in the path; this form is deprecated and will be removed. An unknown path value, or one that belongs to someone else, returns HTTP 404 in both forms.",
                "tags": [
                    "endpoints"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/flowcontacts/contacts/{uuid}/avatar": {
            "post": {
                "operationId": "contact-avatar-upload",
                "summary": "Upload a profile picture",
                "description": "Uploads a contact's profile picture as multipart/form-data and replaces any existing picture. The server crops the image to 500&times;500 pixels and stores it as JPEG; a previously stored picture is removed. JPEG, PNG and WebP up to 8&nbsp;MB are allowed. HEIC and HEIF are not supported, so iOS clients convert to JPEG before uploading. Profile pictures are deliberately not part of the sync push protocol; clients detect changes through avatar_sha1 in the sync pull.",
                "tags": [
                    "endpoints"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                },
                                "example": {
                                    "data": {
                                        "avatar_url": "https://api.flowsuite.one/flowcontacts/contacts/123e4567-e89b-12d3-a456-426614174000/avatar",
                                        "avatar_sha1": "da39a3ee5e6b4b0d3255bfef95601890afd80709",
                                        "avatar_updated_at": "2026-08-16T10:00:00+00:00"
                                    }
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                },
                "requestBody": {
                    "required": true,
                    "content": {
                        "multipart/form-data": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "avatar": {
                                        "type": "string",
                                        "format": "binary",
                                        "description": "Image file as a multipart/form-data field (JPEG, PNG or WebP, max. 8 MB)"
                                    }
                                },
                                "required": [
                                    "avatar"
                                ]
                            }
                        }
                    }
                }
            },
            "get": {
                "operationId": "contact-avatar-download",
                "summary": "Retrieve a profile picture",
                "description": "Returns the image data of the profile picture, usually as image/jpeg. The response carries an ETag with the SHA-1 of the bytes; a call with If-None-Match is answered with 304 Not Modified and no content. External profile pictures, for example from Google Contacts, are redirected to their original URL with 302. Without a stored picture the endpoint answers with 404. Important: like every other endpoint, the URL is protected by the token. It has to be fetched with the Authorization header and does not work in a plain image tag.",
                "tags": [
                    "endpoints"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/octet-stream": {
                                "schema": {
                                    "type": "string",
                                    "format": "binary"
                                }
                            }
                        }
                    },
                    "default": {
                        "description": "Error response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/Error"
                                }
                            }
                        }
                    }
                }
            },
            "delete": {
                "operationId": "contact-avatar-delete",
                "summary": "Delete a profile picture",
                "description": "Removes the contact's profile picture together with the stored file. The call is idempotent: even without a stored picture the server answers with 204 No Content.",
                "tags": [
                    "endpoints"
                ],
                "parameters": [
                    {
                        "name": "uuid",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string",
                            "format": "uuid"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Successful response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    },
                    "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"
                    }
                }
            }
        }
    }
}