openapi: 3.0.3
info:
  title: 'Family Tree API — شجرة العائلة'
  description: "REST API for the Flutter app of one family: the full tree with every member's profile (alive or deceased), family news with comments and likes, and staff whose changes the admin approves."
  version: 1.0.0
servers:
  -
    url: 'https://api.el-khoudary.com'
tags:
  -
    name: Auth
    description: "\nRegistration, login and password reset. Every token is per device."
  -
    name: Meta
    description: "\nPublic lookup data for the app: languages, enum labels and public settings."
  -
    name: Family
    description: "\nThe app shows one family. Its details and settings live here; the persons, graph and news hang off it."
  -
    name: Persons
    description: "\nPeople of a tree. Text fields are translatable: send `{\"ar\": \"...\", \"en\": \"...\"}`,\nor a plain string together with the `Content-Language` header."
  -
    name: 'Family relations'
    description: "\nLineage goes through the father: every son and daughter belongs to their father, eldest first."
  -
    name: Graph
    description: "\nData for the canvas: `nodes` and `families` (each father in view with his sons and daughters, eldest first).\nSend `If-None-Match` with the last ETag to get 304 when nothing changed."
  -
    name: 'Family news'
    description: "\nPosts with images and tagged family members. Anyone can read published posts.\nStaff without `posts.direct` get `202` with a change request instead of saving."
  -
    name: 'Change requests'
    description: "\nStaff writes without a `*.direct` permission return `202` with a change request instead of saving.\nThe admin (or anyone with `changes.review`) approves or rejects it; approval applies the original call."
  -
    name: Notifications
    description: "\nIn-app notifications. The admin gets one for every staff action (saved directly or waiting for approval);\nstaff get one when their request is approved or rejected."
  -
    name: 'Admin — Users'
    description: "\nUsers and staff, managed by the admin from the app."
  -
    name: 'Admin — Languages'
    description: "\nLanguages available for translatable data. Adding one makes it accepted in every translatable field."
  -
    name: 'Admin — Settings'
    description: ''
  -
    name: 'Admin — System'
    description: ''
  -
    name: Endpoints
    description: ''
components:
  securitySchemes:
    default:
      type: http
      scheme: bearer
      description: 'Get a token from <code>POST /api/v1/auth/login</code> and send it as <code>Authorization: Bearer {TOKEN}</code>.'
security:
  -
    default: []
paths:
  /api/v1/auth/register:
    post:
      summary: Register
      operationId: register
      description: 'Creates an account with the `user` role and returns an API token.'
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Auth
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: 'يجب ألا يتجاوز طول value 150 حرفاً.'
                  example: vmqeopfuudtdsufvyvddq
                email:
                  type: string
                  description: 'يجب أن يكون value بريداً إلكترونياً صحيحاً. يجب ألا يتجاوز طول value 191 حرفاً.'
                  example: kunde.eloisa@example.com
                phone:
                  type: string
                  description: 'يجب ألا يتجاوز طول value 30 حرفاً.'
                  example: hfqcoynlazghdtqtqxbaj
                  nullable: true
                password:
                  type: string
                  description: ''
                  example: consequatur
                locale:
                  type: string
                  description: ''
                  example: null
                  nullable: true
                device_name:
                  type: string
                  description: 'يجب ألا يتجاوز طول value 100 حرفاً.'
                  example: mqeopfuudtdsufvyvddqa
                  nullable: true
              required:
                - name
                - email
                - password
      security: []
  /api/v1/auth/login:
    post:
      summary: Login
      operationId: login
      description: "Sign in with an email, a username, the national ID of the linked tree member, or a phone number\n(`login`: the login screen has one field for all of them).\n`email` still works for older clients. Returns a Bearer token; send it as `Authorization: Bearer <token>`.\nThe Postman collection saves it automatically."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Auth
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                login:
                  type: string
                  description: 'This field is required when <code>email</code> is not present. يجب ألا يتجاوز طول value 191 حرفاً.'
                  example: vmqeopfuudtdsufvyvddq
                  nullable: true
                email:
                  type: string
                  description: 'This field is required when <code>login</code> is not present. يجب ألا يتجاوز طول value 191 حرفاً.'
                  example: kunde.eloisa@example.com
                  nullable: true
                password:
                  type: string
                  description: ''
                  example: 'O[2UZ5ij-e/dl4m{o,'
                device_name:
                  type: string
                  description: 'يجب ألا يتجاوز طول value 100 حرفاً.'
                  example: dqamniihfqcoynlazghdt
                  nullable: true
              required:
                - password
      security: []
  /api/v1/auth/forgot-password:
    post:
      summary: 'Forgot password'
      operationId: forgotPassword
      description: "With `email`: sends a reset link by email. With `phone`: sends a 4-digit code by SMS\n(valid for `expires_in` seconds; ask again after `resend_after` seconds).\nAlways answers 200 so registered accounts are not revealed."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Auth
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  description: 'This field is required when <code>phone</code> is not present. يجب أن يكون value بريداً إلكترونياً صحيحاً.'
                  example: qkunze@example.com
                  nullable: true
                phone:
                  type: string
                  description: 'This field is required when <code>email</code> is not present. يجب ألا يتجاوز طول value 30 حرفاً.'
                  example: opfuudtdsufvyvddqamni
                  nullable: true
      security: []
  /api/v1/auth/reset-password:
    post:
      summary: 'Reset password'
      operationId: resetPassword
      description: "Either `email` + `token` (from the email link) or `phone` + `code` (from the SMS).\nAfter 5 wrong codes the code is cancelled and a new one must be requested."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Auth
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                email:
                  type: string
                  description: 'This field is required when <code>phone</code> is not present. يجب أن يكون value بريداً إلكترونياً صحيحاً.'
                  example: qkunze@example.com
                  nullable: true
                token:
                  type: string
                  description: 'This field is required when <code>email</code> is present.'
                  example: consequatur
                  nullable: true
                phone:
                  type: string
                  description: 'This field is required when <code>email</code> is not present. يجب ألا يتجاوز طول value 30 حرفاً.'
                  example: mqeopfuudtdsufvyvddqa
                  nullable: true
                code:
                  type: string
                  description: 'This field is required when <code>phone</code> is present. يجب أن يحتوي value على 4 أرقام.'
                  example: '8107'
                  nullable: true
                password:
                  type: string
                  description: ''
                  example: consequatur
              required:
                - password
      security: []
  /api/v1/auth/logout:
    post:
      summary: 'Logout (current device)'
      operationId: logoutcurrentDevice
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Auth
  /api/v1/auth/logout-all:
    post:
      summary: 'Logout from all devices'
      operationId: logoutFromAllDevices
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Auth
  /api/v1/auth/me:
    get:
      summary: 'My profile, roles and permissions'
      operationId: myProfileRolesAndPermissions
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Auth
    patch:
      summary: 'Update my profile'
      operationId: updateMyProfile
      description: '`locale` is the default response language when no Accept-Language header is sent.'
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Auth
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: 'يجب ألا يتجاوز طول value 150 حرفاً.'
                  example: vmqeopfuudtdsufvyvddq
                email:
                  type: string
                  description: 'يجب أن يكون value بريداً إلكترونياً صحيحاً. يجب ألا يتجاوز طول value 191 حرفاً.'
                  example: kunde.eloisa@example.com
                phone:
                  type: string
                  description: 'يجب ألا يتجاوز طول value 30 حرفاً.'
                  example: hfqcoynlazghdtqtqxbaj
                  nullable: true
                locale:
                  type: string
                  description: ''
                  example: null
    delete:
      summary: 'Delete my account'
      operationId: deleteMyAccount
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Auth
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                password:
                  type: string
                  description: ''
                  example: 'O[2UZ5ij-e/dl4m{o,'
              required:
                - password
  /api/v1/auth/me/password:
    put:
      summary: 'Change my password'
      operationId: changeMyPassword
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Auth
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                password:
                  type: string
                  description: ''
                  example: consequatur
              required:
                - password
  /api/v1/meta/languages:
    get:
      summary: 'Active languages'
      operationId: activeLanguages
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Meta
      security: []
  /api/v1/meta/enums:
    get:
      summary: 'Enums with translated labels'
      operationId: enumsWithTranslatedLabels
      description: 'Gendered Arabic labels are returned as `{ male, female }`.'
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Meta
      security: []
  /api/v1/meta/settings:
    get:
      summary: 'Public settings'
      operationId: publicSettings
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Meta
      security: []
  /api/v1/meta/privacy-policy:
    get:
      summary: 'Privacy policy'
      operationId: privacyPolicy
      description: "The policy to show inside the app: a `title` and a `body` of plain text (headings on their own line, bullets start with \"- \",\nblocks separated by a blank line). Always in Arabic.\nThe public web page for the app stores is `/privacy-policy`."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Meta
      security: []
  /api/v1/family:
    get:
      summary: 'Family details'
      operationId: familyDetails
      description: 'Name, description, root person, settings and counters.'
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Family
      security: []
    patch:
      summary: 'Update the family'
      operationId: updateTheFamily
      description: 'Admin only (`family.update`). `settings.lineage_depth` / `lineage_format` shape the lineage name ("محمد بن أحمد بن علي").'
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Family
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: object
                  description: Translatable.
                  example:
                    ar: 'عائلة الأطرش'
                    en: 'Al-Atrash Family'
                  properties: {  }
                description:
                  type: object
                  description: Translatable.
                  example:
                    ar: 'شجرة عائلة الأطرش'
                  properties: {  }
                  nullable: true
                default_locale:
                  type: string
                  description: ''
                  example: null
                root_person_id:
                  type: string
                  description: ''
                  example: null
                  nullable: true
                settings:
                  type: object
                  description: ''
                  example: null
                  properties:
                    lineage_depth:
                      type: integer
                      description: 'يجب أن تكون قيمة value 1 على الأقل. يجب ألا تتجاوز قيمة value 10.'
                      example: 9
                    lineage_format:
                      type: string
                      description: ''
                      example: null
                  nullable: true
  /api/v1/family/stats:
    get:
      summary: 'Family statistics'
      operationId: familyStatistics
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Family
      security: []
  /api/v1/family/generations:
    get:
      summary: Generations
      operationId: generations
      description: "The generations screen: one row per generation with its name, size and birth years.\n`q` narrows the counts to people matching a name, kunya or reference number."
      parameters:
        -
          in: query
          name: q
          description: 'Name, kunya or reference number.'
          example: 0
          required: false
          schema:
            type: integer
            description: 'Name, kunya or reference number.'
            example: 0
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Family
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                q:
                  type: string
                  description: 'يجب ألا يتجاوز طول value 100 حرفاً.'
                  example: vmqeopfuudtdsufvyvddq
                  nullable: true
      security: []
  /api/v1/persons:
    get:
      summary: 'List persons'
      operationId: listPersons
      description: ''
      parameters:
        -
          in: query
          name: 'filter[gender]'
          description: ''
          example: male
          required: false
          schema:
            type: string
            description: ''
            example: male
        -
          in: query
          name: 'filter[life_status]'
          description: 'alive, deceased or unknown.'
          example: alive
          required: false
          schema:
            type: string
            description: 'alive, deceased or unknown.'
            example: alive
        -
          in: query
          name: 'filter[father_id]'
          description: 'Children of a father.'
          example: consequatur
          required: false
          schema:
            type: string
            description: 'Children of a father.'
            example: consequatur
        -
          in: query
          name: 'filter[generation]'
          description: ''
          example: '1'
          required: false
          schema:
            type: string
            description: ''
            example: '1'
        -
          in: query
          name: 'filter[search]'
          description: 'Name search in every language (Arabic normalized).'
          example: محمد
          required: false
          schema:
            type: string
            description: 'Name search in every language (Arabic normalized).'
            example: محمد
        -
          in: query
          name: sort
          description: 'birth_date, -birth_date, created_at, generation, birth_order.'
          example: birth_date
          required: false
          schema:
            type: string
            description: 'birth_date, -birth_date, created_at, generation, birth_order.'
            example: birth_date
        -
          in: query
          name: per_page
          description: 'Max 100.'
          example: '25'
          required: false
          schema:
            type: string
            description: 'Max 100.'
            example: '25'
        -
          in: query
          name: 'filter[birth_year]'
          description: "Exact year of birth (the generation screen's year menu)."
          example: '1946'
          required: false
          schema:
            type: string
            description: "Exact year of birth (the generation screen's year menu)."
            example: '1946'
        -
          in: query
          name: 'filter[age_from]'
          description: 'Minimum age in full years; for deceased people this is age at death.'
          example: '20'
          required: false
          schema:
            type: string
            description: 'Minimum age in full years; for deceased people this is age at death.'
            example: '20'
        -
          in: query
          name: 'filter[age_to]'
          description: 'Maximum age in full years; for deceased people this is age at death.'
          example: '65'
          required: false
          schema:
            type: string
            description: 'Maximum age in full years; for deceased people this is age at death.'
            example: '65'
        -
          in: query
          name: 'filter[birth_place]'
          description: 'Partial match in place of birth.'
          example: Ramallah
          required: false
          schema:
            type: string
            description: 'Partial match in place of birth.'
            example: Ramallah
        -
          in: query
          name: 'filter[country_id]'
          description: 'Country lookup ID.'
          example: 1
          required: false
          schema:
            type: integer
            description: 'Country lookup ID.'
            example: 1
        -
          in: query
          name: 'filter[city_id]'
          description: 'City lookup ID.'
          example: '2'
          required: false
          schema:
            type: string
            description: 'City lookup ID.'
            example: '2'
        -
          in: query
          name: 'filter[neighborhood]'
          description: 'Partial match in neighborhood.'
          example: Al-Bireh
          required: false
          schema:
            type: string
            description: 'Partial match in neighborhood.'
            example: Al-Bireh
        -
          in: query
          name: 'filter[residence]'
          description: 'Partial match in country, city, or neighborhood.'
          example: 0
          required: false
          schema:
            type: integer
            description: 'Partial match in country, city, or neighborhood.'
            example: 0
        -
          in: query
          name: 'filter[marital_status_id]'
          description: 'Marital status lookup ID.'
          example: '2'
          required: false
          schema:
            type: string
            description: 'Marital status lookup ID.'
            example: '2'
        -
          in: query
          name: 'filter[educational_qualification_id]'
          description: 'Educational qualification lookup ID.'
          example: '4'
          required: false
          schema:
            type: string
            description: 'Educational qualification lookup ID.'
            example: '4'
        -
          in: query
          name: 'filter[occupation]'
          description: 'Partial match in occupation.'
          example: teacher
          required: false
          schema:
            type: string
            description: 'Partial match in occupation.'
            example: teacher
        -
          in: query
          name: 'filter[specialty]'
          description: 'Partial match in specialty.'
          example: medicine
          required: false
          schema:
            type: string
            description: 'Partial match in specialty.'
            example: medicine
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Persons
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                filter:
                  type: object
                  description: ''
                  example: []
                  properties:
                    age_from:
                      type: integer
                      description: 'يجب أن تكون قيمة value 0 على الأقل. يجب ألا تتجاوز قيمة value 150.'
                      example: 21
                    age_to:
                      type: integer
                      description: 'يجب أن تكون قيمة value 0 على الأقل. يجب ألا تتجاوز قيمة value 150.'
                      example: 13
                    birth_place:
                      type: string
                      description: 'يجب ألا يتجاوز طول value 150 حرفاً.'
                      example: qeopfuudtdsufvyvddqam
                    country_id:
                      type: integer
                      description: 'Must match an existing stored value.'
                      example: 17
                    city_id:
                      type: integer
                      description: 'Must match an existing stored value.'
                      example: 17
                    neighborhood:
                      type: string
                      description: 'يجب ألا يتجاوز طول value 150 حرفاً.'
                      example: mqeopfuudtdsufvyvddqa
                    residence:
                      type: string
                      description: 'يجب ألا يتجاوز طول value 150 حرفاً.'
                      example: mniihfqcoynlazghdtqtq
                    marital_status_id:
                      type: integer
                      description: 'Must match an existing stored value.'
                      example: 17
                    educational_qualification_id:
                      type: integer
                      description: 'Must match an existing stored value.'
                      example: 17
                    occupation:
                      type: string
                      description: 'يجب ألا يتجاوز طول value 150 حرفاً.'
                      example: mqeopfuudtdsufvyvddqa
                    specialty:
                      type: string
                      description: 'يجب ألا يتجاوز طول value 150 حرفاً.'
                      example: mniihfqcoynlazghdtqtq
      security: []
    post:
      summary: 'Create a person'
      operationId: createAPerson
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Persons
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                father_id:
                  type: string
                  description: "The father's id. Required once the tree has a root; only the first person has none (FATHER_REQUIRED)."
                  example: "01hzx3k9m2f8d5t6q4v7w1y0ab\nThe reference number (`ref_no`) is generated: the next number in the family's sequence. It cannot be sent or changed."
                name:
                  type: object
                  description: 'The full name, Arabic is required. The same name and birth date under the same father is rejected (DUPLICATE_PERSON).'
                  example:
                    ar: 'فاطمة أحمد الخضري'
                    en: 'Fatima Ahmad Al-Khudari'
                  properties: {  }
                photo:
                  type: string
                  format: binary
                  description: 'Profile photo, optional (jpg, png, webp — max 5 MB). Send the request as multipart/form-data.'
                title:
                  type: object
                  description: 'Translatable honorific shown before the name (الحاج، الشيخ، الدكتور…).'
                  example:
                    ar: الحاج
                    en: Hajj
                  properties: {  }
                phone:
                  type: string
                  description: 'Contact phone number, optional (it may be unknown).'
                  example: '+970599000000'
                national_id:
                  type: string
                  description: 'Government identity number, unique in the tree (NATIONAL_ID_TAKEN).'
                  example: '123456789'
                neighborhood:
                  type: object
                  description: 'Translatable neighborhood name.'
                  example: []
                  properties: {  }
                specialty:
                  type: object
                  description: 'Translatable specialty, separate from occupation.'
                  example: []
                  properties: {  }
                country_id:
                  type: integer
                  description: 'Country lookup ID.'
                  example: 1
                city_id:
                  type: integer
                  description: 'City lookup ID belonging to country_id.'
                  example: 2
                educational_qualification_id:
                  type: integer
                  description: 'Educational qualification lookup ID.'
                  example: 4
                marital_status_id:
                  type: integer
                  description: 'Marital status lookup ID.'
                  example: 2
                birth_date:
                  type: string
                  description: 'Date of birth as YYYY-MM-DD (always a full date, even when only the year is known).'
                  example: '1990-05-12'
                birth_date_precision:
                  type: string
                  description: 'How precise birth_date is: exact (full date, default), month (month and year only), year (year only), approx (approximate).'
                  example: exact
                death_date:
                  type: string
                  description: 'Date of death as YYYY-MM-DD, only with life_status deceased.'
                  example: '2010-12-01'
                death_date_precision:
                  type: string
                  description: 'Same values as birth_date_precision: exact, month, year, approx.'
                  example: exact
              required:
                - name
  /api/v1/persons/search:
    get:
      summary: 'Quick search'
      operationId: quickSearch
      description: "Short results for pickers (e.g. choosing a father). Matches every language,\nwith Arabic normalization: \"احمد\" finds \"أحمد\". A number finds the person with that reference number (`ref_no`)."
      parameters:
        -
          in: query
          name: q
          description: 'A name, or a reference number.'
          example: احمد
          required: true
          schema:
            type: string
            description: 'A name, or a reference number.'
            example: احمد
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Persons
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                q:
                  type: string
                  description: 'يجب أن يكون طول value 1 أحرف على الأقل. يجب ألا يتجاوز طول value 100 حرفاً.'
                  example: vmqeopfuudtdsufvyvddq
              required:
                - q
      security: []
  '/api/v1/persons/{id}':
    get:
      summary: 'Person details'
      operationId: personDetails
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Persons
      security: []
    patch:
      summary: 'Update a person (partial)'
      operationId: updateAPersonpartial
      description: "Takes the same fields as creating a person, all optional: send only what changes. That includes `father_id`\n(moves the person under another father, with the same lineage rules; `null` detaches) and `photo` (replaces the photo).\nTo send a photo, use multipart/form-data with `POST` and a `_method=PATCH` field: PHP does not read a file from a real PATCH body."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Persons
      requestBody:
        required: false
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                father_id:
                  type: string
                  description: "The new father's id, or null."
                  example: 01hzx3k9m2f8d5t6q4v7w1y0ab
                photo:
                  type: string
                  format: binary
                  description: 'Replacement profile photo (jpg, png, webp — max 5 MB), multipart/form-data.'
    delete:
      summary: 'Delete a person (soft)'
      operationId: deleteAPersonsoft
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Persons
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the person.'
        example: 01m6bdggxeeh8svafkax6668ry
        required: true
        schema:
          type: string
  '/api/v1/persons/{person_id}/card':
    get:
      summary: 'Person card (Bottom Sheet)'
      operationId: personCardBottomSheet
      description: "Everything the bottom sheet shows: lineage name, father, counts,\nthe children (sons and daughters) eldest first, and the allowed actions in `can`."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Persons
      security: []
    parameters:
      -
        in: path
        name: person_id
        description: 'The ID of the person.'
        example: 01m6bdggxeeh8svafkax6668ry
        required: true
        schema:
          type: string
  '/api/v1/persons/{person_id}/profile':
    get:
      summary: 'Person profile (the full page)'
      operationId: personProfiletheFullPage
      description: "Everything the profile screen shows in one call: the header (`full_name`, `lineage_name`, `kunya`, `photo`, `counts`, `can`…),\n`details` with the complete information (the \"بيانات النسب\" tab), `children` (sons and daughters, eldest first —\nthe \"فروع العائلة\" tab) and `posts` (the latest published news that mention the person — the \"الأخبار المرتبطة\" tab).\n`relatives` has the family branches: `father`, `grandfather`, `siblings`, `children`, `paternal_uncles` and `paternal_aunts`\n(uncles and aunts in separate arrays; `paternal_uncles_and_aunts` is the old combined list).\n`posts_total` tells whether there are more: page them with `GET /persons/{id}/posts`."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Persons
      security: []
    parameters:
      -
        in: path
        name: person_id
        description: 'The ID of the person.'
        example: 01m6bdggxeeh8svafkax6668ry
        required: true
        schema:
          type: string
  /api/v1/trash/persons:
    get:
      summary: 'Deleted persons (trash)'
      operationId: deletedPersonstrash
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Persons
  '/api/v1/persons/{personId}/restore':
    post:
      summary: 'Restore a deleted person'
      operationId: restoreADeletedPerson
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Persons
    parameters:
      -
        in: path
        name: personId
        description: ''
        example: 01m6bdggxeeh8svafkax6668ry
        required: true
        schema:
          type: string
  '/api/v1/persons/{personId}/force':
    delete:
      summary: 'Delete a person permanently (owner)'
      operationId: deleteAPersonPermanentlyowner
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Persons
    parameters:
      -
        in: path
        name: personId
        description: ''
        example: 01m6bdggxeeh8svafkax6668ry
        required: true
        schema:
          type: string
  '/api/v1/persons/{person_id}/father':
    put:
      summary: 'Set the father'
      operationId: setTheFather
      description: "Applies the lineage rules: the father is a man of the family, not a descendant of this person,\nand at least 12 years older when both birth dates are known. `null` clears it."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Persons
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                father_id:
                  type: string
                  description: "The father's id, or null."
                  example: null
                  nullable: true
              required:
                - father_id
    parameters:
      -
        in: path
        name: person_id
        description: 'The ID of the person.'
        example: 01m6bdggxeeh8svafkax6668ry
        required: true
        schema:
          type: string
  '/api/v1/persons/{person_id}/photo':
    post:
      summary: 'Upload the profile photo'
      operationId: uploadTheProfilePhoto
      description: "multipart/form-data, field `photo` (jpg, png, webp — max 5 MB).\nGenerates `thumb` (96×96 WebP, for the canvas nodes) and `preview` (400px, for the bottom sheet)."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Persons
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                photo:
                  type: string
                  format: binary
                  description: 'يجب أن يكون value صورة. يجب ألا يتجاوز حجم value 5120 كيلوبايت.'
              required:
                - photo
    delete:
      summary: 'Delete the profile photo'
      operationId: deleteTheProfilePhoto
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Persons
    parameters:
      -
        in: path
        name: person_id
        description: 'The ID of the person.'
        example: 01m6bdggxeeh8svafkax6668ry
        required: true
        schema:
          type: string
  '/api/v1/persons/{person_id}/relatives':
    get:
      summary: 'Relatives: father, grandfather, siblings, children, paternal uncles and aunts'
      operationId: relativesFatherGrandfatherSiblingsChildrenPaternalUnclesAndAunts
      description: "Paternal uncles (`paternal_uncles`) and aunts (`paternal_aunts`) come in separate arrays, eldest first.\n`paternal_uncles_and_aunts` is the old combined list, kept for older clients."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family relations'
      security: []
    post:
      summary: 'Add a relative (the + button)'
      operationId: addARelativethe+Button
      description: "Creates the person and links them through the father in one step. Gender comes from `relation`.\n- son / daughter: of this person (a man).\n- father: when this person has none yet (PARENT_ALREADY_SET otherwise).\n- brother / sister: needs this person's father (PARENTS_REQUIRED_FOR_SIBLING otherwise).\n\nThe response includes the updated graph around the anchor, so the canvas can merge it without reloading."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family relations'
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                relation:
                  type: string
                  description: 'father, son, daughter, brother or sister.'
                  example: son
                photo:
                  type: string
                  format: binary
                  description: 'Profile photo of the new person, optional (jpg, png, webp — max 5 MB). Send the request as multipart/form-data.'
                person:
                  type: object
                  description: 'The new person.'
                  example:
                    name:
                      ar: 'أحمد محمد'
                      en: 'Ahmad Mohammed'
                    birth_date: '1990-03-12'
                  properties: {  }
              required:
                - relation
                - person
    parameters:
      -
        in: path
        name: person_id
        description: 'The ID of the person.'
        example: 01m6bdggxeeh8svafkax6668ry
        required: true
        schema:
          type: string
  '/api/v1/persons/{person_id}/family':
    get:
      summary: 'Family: father and children'
      operationId: familyFatherAndChildren
      description: "The person, their father, and their children (sons and daughters together) eldest first.\n`meta` has the counts of sons, daughters and living children."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family relations'
      security: []
    parameters:
      -
        in: path
        name: person_id
        description: 'The ID of the person.'
        example: 01m6bdggxeeh8svafkax6668ry
        required: true
        schema:
          type: string
  '/api/v1/persons/{person_id}/relationship/{relative_id}':
    get:
      summary: 'Relationship between two people'
      operationId: relationshipBetweenTwoPeople
      description: "Finds the closest shared ancestor through the father's line and returns a display label plus\nmachine-readable distances."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family relations'
      security: []
    parameters:
      -
        in: path
        name: person_id
        description: 'The ID of the person.'
        example: 01m6bdggxeeh8svafkax6668ry
        required: true
        schema:
          type: string
      -
        in: path
        name: relative_id
        description: 'The ID of the relative.'
        example: 01m6bdggxeeh8svafkax6668ry
        required: true
        schema:
          type: string
  '/api/v1/persons/{person_id}/children':
    get:
      summary: Children
      operationId: children
      description: 'Sons and daughters, eldest first.'
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family relations'
      security: []
    parameters:
      -
        in: path
        name: person_id
        description: 'The ID of the person.'
        example: 01m6bdggxeeh8svafkax6668ry
        required: true
        schema:
          type: string
  '/api/v1/persons/{person_id}/ancestors':
    get:
      summary: "Ancestors (the father's line)"
      operationId: ancestorstheFathersLine
      description: ''
      parameters:
        -
          in: query
          name: depth
          description: 'Generations up, max 20.'
          example: '4'
          required: false
          schema:
            type: string
            description: 'Generations up, max 20.'
            example: '4'
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family relations'
      security: []
    parameters:
      -
        in: path
        name: person_id
        description: 'The ID of the person.'
        example: 01m6bdggxeeh8svafkax6668ry
        required: true
        schema:
          type: string
  '/api/v1/persons/{person_id}/descendants':
    get:
      summary: Descendants
      operationId: descendants
      description: 'Each level lists the children of the previous one, with their `father_id`.'
      parameters:
        -
          in: query
          name: depth
          description: 'Generations down, max 10.'
          example: '3'
          required: false
          schema:
            type: string
            description: 'Generations down, max 10.'
            example: '3'
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family relations'
      security: []
    parameters:
      -
        in: path
        name: person_id
        description: 'The ID of the person.'
        example: 01m6bdggxeeh8svafkax6668ry
        required: true
        schema:
          type: string
  '/api/v1/persons/{person_id}/children/order':
    put:
      summary: 'Reorder children manually'
      operationId: reorderChildrenManually
      description: "For twins or children without a birth date. Send every child of this father in the new order.\nChildren with known dates are re-sorted by date whenever a sibling is added or a date changes."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family relations'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                order:
                  type: array
                  description: "All the father's children, eldest first."
                  example:
                    - consequatur
                  items:
                    type: string
              required:
                - order
    parameters:
      -
        in: path
        name: person_id
        description: 'The ID of the person.'
        example: 01m6bdggxeeh8svafkax6668ry
        required: true
        schema:
          type: string
  /api/v1/graph:
    get:
      summary: 'Tree graph'
      operationId: treeGraph
      description: ''
      parameters:
        -
          in: query
          name: root
          description: 'Person to center on (default: the tree root).'
          example: consequatur
          required: false
          schema:
            type: string
            description: 'Person to center on (default: the tree root).'
            example: consequatur
        -
          in: query
          name: depth_up
          description: "Generations of the father's line, max 12."
          example: '2'
          required: false
          schema:
            type: string
            description: "Generations of the father's line, max 12."
            example: '2'
        -
          in: query
          name: depth_down
          description: 'Generations of descendants, max 12.'
          example: '3'
          required: false
          schema:
            type: string
            description: 'Generations of descendants, max 12.'
            example: '3'
        -
          in: query
          name: max_nodes
          description: 'Max 2000.'
          example: '300'
          required: false
          schema:
            type: string
            description: 'Max 2000.'
            example: '300'
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Graph
      security: []
  '/api/v1/graph/expand/{person_id}':
    get:
      summary: 'Expand a node'
      operationId: expandANode
      description: "Loads the hidden branch around a node (when `has_more_up` / `has_more_down` is true).\nMerge the result into the canvas by id."
      parameters:
        -
          in: query
          name: direction
          description: 'up, down or both.'
          example: down
          required: false
          schema:
            type: string
            description: 'up, down or both.'
            example: down
        -
          in: query
          name: depth
          description: ''
          example: '2'
          required: false
          schema:
            type: string
            description: ''
            example: '2'
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Graph
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                direction:
                  type: string
                  description: ''
                  example: null
                depth:
                  type: integer
                  description: 'يجب أن تكون قيمة value 1 على الأقل.'
                  example: 73
      security: []
    parameters:
      -
        in: path
        name: person_id
        description: 'The ID of the person.'
        example: 01m6bdggxeeh8svafkax6668ry
        required: true
        schema:
          type: string
  '/api/v1/persons/{person_id}/posts':
    get:
      summary: 'News about a person'
      operationId: newsAboutAPerson
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family news'
      security: []
    parameters:
      -
        in: path
        name: person_id
        description: 'The ID of the person.'
        example: 01m6bdggxeeh8svafkax6668ry
        required: true
        schema:
          type: string
  /api/v1/posts:
    get:
      summary: 'News feed'
      operationId: newsFeed
      description: 'Pinned posts first, then newest. Drafts and scheduled posts are only listed for users who can write posts (`status=draft`).'
      parameters:
        -
          in: query
          name: type
          description: 'news, obituary, wedding, birth, event or announcement.'
          example: news
          required: false
          schema:
            type: string
            description: 'news, obituary, wedding, birth, event or announcement.'
            example: news
        -
          in: query
          name: person_id
          description: 'Only posts about this person.'
          example: 01j9z3q4r5s6t7v8w9x0y1z2a3
          required: false
          schema:
            type: string
            description: 'Only posts about this person.'
            example: 01j9z3q4r5s6t7v8w9x0y1z2a3
        -
          in: query
          name: q
          description: 'Search in titles.'
          example: زفاف
          required: false
          schema:
            type: string
            description: 'Search in titles.'
            example: زفاف
        -
          in: query
          name: status
          description: 'draft or published (writers only).'
          example: published
          required: false
          schema:
            type: string
            description: 'draft or published (writers only).'
            example: published
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family news'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                type:
                  type: string
                  description: ''
                  example: obituary
                  enum:
                    - news
                    - obituary
                    - wedding
                    - birth
                    - event
                    - announcement
                status:
                  type: string
                  description: ''
                  example: draft
                  enum:
                    - draft
                    - published
                person_id:
                  type: string
                  description: ''
                  example: null
                q:
                  type: string
                  description: 'يجب ألا يتجاوز طول value 100 حرفاً.'
                  example: vmqeopfuudtdsufvyvddq
      security: []
    post:
      summary: 'Create a post'
      operationId: createAPost
      description: "JSON, or multipart/form-data to attach `images[]` (jpg, png, webp, up to 10 × 10 MB).\n`status=published` with no `published_at` publishes now; a future `published_at` schedules it."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family news'
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                title:
                  type: object
                  description: Translatable.
                  example:
                    ar: 'زفاف محمد'
                    en: "Mohammed's wedding"
                  properties: {  }
                body:
                  type: object
                  description: Translatable.
                  example:
                    ar: 'يسرّ العائلة دعوتكم…'
                  properties: {  }
                type:
                  type: string
                  description: 'news, obituary, wedding, birth, event or announcement.'
                  example: wedding
                person_ids:
                  type: array
                  description: 'Family members the post is about.'
                  example: []
                  items:
                    type: string
                link:
                  type: string
                  description: 'Link of the original post or article (shown as "رابط عن الخبر").'
                  example: 'https://example.com/news/1'
                videos:
                  type: array
                  description: 'mp4 or mov, up to 3 × 50 MB (multipart/form-data).'
                  items:
                    type: string
                    format: binary
              required:
                - title
  '/api/v1/posts/{id}':
    get:
      summary: 'Post details'
      operationId: postDetails
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family news'
      security: []
    patch:
      summary: 'Update a post'
      operationId: updateAPost
      description: 'Partial. Add images with `POST /posts/{post}/images`.'
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family news'
    delete:
      summary: 'Delete a post'
      operationId: deleteAPost
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family news'
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the post.'
        example: 01m485akfnz4pemfrhv19ch6kc
        required: true
        schema:
          type: string
  '/api/v1/posts/{post_id}/comments':
    get:
      summary: 'Comments of a post'
      operationId: commentsOfAPost
      description: 'Oldest first. Empty when comments are turned off for the post.'
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family news'
      security: []
    post:
      summary: 'Add a comment'
      operationId: addAComment
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family news'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                body:
                  type: string
                  description: ''
                  example: 'ألف مبروك'
              required:
                - body
    parameters:
      -
        in: path
        name: post_id
        description: 'The ID of the post.'
        example: 01m485akfnz4pemfrhv19ch6kc
        required: true
        schema:
          type: string
  '/api/v1/posts/{post_id}/likes':
    get:
      summary: 'Who liked a post'
      operationId: whoLikedAPost
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family news'
      security: []
    parameters:
      -
        in: path
        name: post_id
        description: 'The ID of the post.'
        example: 01m485akfnz4pemfrhv19ch6kc
        required: true
        schema:
          type: string
  '/api/v1/comments/{id}':
    delete:
      summary: 'Delete a comment'
      operationId: deleteAComment
      description: 'The author, or anyone with `comments.moderate`.'
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family news'
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the comment.'
        example: 01m485art56yasqdgam4gyrjzc
        required: true
        schema:
          type: string
  '/api/v1/posts/{post_id}/like':
    post:
      summary: 'Like a post'
      operationId: likeAPost
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family news'
    delete:
      summary: 'Remove my like'
      operationId: removeMyLike
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family news'
    parameters:
      -
        in: path
        name: post_id
        description: 'The ID of the post.'
        example: 01m485akfnz4pemfrhv19ch6kc
        required: true
        schema:
          type: string
  '/api/v1/posts/{post_id}/images':
    post:
      summary: 'Add images'
      operationId: addImages
      description: 'multipart/form-data, `images[]` (jpg, png, webp — 10 MB each, 10 per post).'
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family news'
      requestBody:
        required: false
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                images:
                  type: array
                  description: 'يجب أن يكون value صورة. يجب ألا يتجاوز حجم value 10240 كيلوبايت.'
                  items:
                    type: string
                    format: binary
    parameters:
      -
        in: path
        name: post_id
        description: 'The ID of the post.'
        example: 01m485akfnz4pemfrhv19ch6kc
        required: true
        schema:
          type: string
  /api/v1/posts/import-preview:
    post:
      summary: 'Import from a link'
      operationId: importFromALink
      description: "The \"إستيراد عبر رابط\" tab: reads the public preview (title, text, image) of a Facebook, Instagram,\nTelegram or WhatsApp link, or any web page, so the app can pre-fill the form. Nothing is saved.\nPrivate posts and pages that need a login cannot be read: the answer is `422 IMPORT_FAILED`."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family news'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                url:
                  type: string
                  description: ''
                  example: 'https://t.me/khudari_family/12'
              required:
                - url
  '/api/v1/posts/{post_id}/videos':
    post:
      summary: 'Add videos'
      operationId: addVideos
      description: 'multipart/form-data, `videos[]` (mp4 or mov, 50 MB each, 3 per post).'
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family news'
      requestBody:
        required: false
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                videos:
                  type: array
                  description: 'Must be a file. يجب ألا يتجاوز حجم value 51200 كيلوبايت.'
                  items:
                    type: string
                    format: binary
    parameters:
      -
        in: path
        name: post_id
        description: 'The ID of the post.'
        example: 01m485akfnz4pemfrhv19ch6kc
        required: true
        schema:
          type: string
  '/api/v1/posts/{post_id}/videos/{media}':
    delete:
      summary: 'Delete a video'
      operationId: deleteAVideo
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family news'
    parameters:
      -
        in: path
        name: post_id
        description: 'The ID of the post.'
        example: 01m485akfnz4pemfrhv19ch6kc
        required: true
        schema:
          type: string
      -
        in: path
        name: media
        description: ''
        example: consequatur
        required: true
        schema:
          type: string
  '/api/v1/posts/{post_id}/images/{media}':
    delete:
      summary: 'Delete an image'
      operationId: deleteAnImage
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Family news'
    parameters:
      -
        in: path
        name: post_id
        description: 'The ID of the post.'
        example: 01m485akfnz4pemfrhv19ch6kc
        required: true
        schema:
          type: string
      -
        in: path
        name: media
        description: ''
        example: consequatur
        required: true
        schema:
          type: string
  /api/v1/change-requests:
    get:
      summary: 'Change requests'
      operationId: changeRequests
      description: "Reviewers see everyone's requests; staff see their own. `meta.pending_count` is for the badge."
      parameters:
        -
          in: query
          name: status
          description: 'pending, approved, rejected or cancelled.'
          example: pending
          required: false
          schema:
            type: string
            description: 'pending, approved, rejected or cancelled.'
            example: pending
        -
          in: query
          name: area
          description: 'persons or posts.'
          example: persons
          required: false
          schema:
            type: string
            description: 'persons or posts.'
            example: persons
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Change requests'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                status:
                  type: string
                  description: ''
                  example: approved
                  enum:
                    - pending
                    - approved
                    - rejected
                    - cancelled
                area:
                  type: string
                  description: ''
                  example: null
  '/api/v1/change-requests/{changeRequest_id}':
    get:
      summary: 'Change request details'
      operationId: changeRequestDetails
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Change requests'
    delete:
      summary: 'Cancel my pending request'
      operationId: cancelMyPendingRequest
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Change requests'
    parameters:
      -
        in: path
        name: changeRequest_id
        description: 'The ID of the changeRequest.'
        example: consequatur
        required: true
        schema:
          type: string
  '/api/v1/change-requests/{changeRequest_id}/approve':
    post:
      summary: Approve
      operationId: approve
      description: "Applies the original call as the staff member who made it. If the tree changed in between\nand the call now fails, the response is `409 CHANGE_REQUEST_FAILED` with the reason, and the request stays pending."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Change requests'
    parameters:
      -
        in: path
        name: changeRequest_id
        description: 'The ID of the changeRequest.'
        example: consequatur
        required: true
        schema:
          type: string
  '/api/v1/change-requests/{changeRequest_id}/reject':
    post:
      summary: Reject
      operationId: reject
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Change requests'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                note:
                  type: string
                  description: 'The reason, shown to the staff member.'
                  example: 'The birth date is wrong'
                  nullable: true
    parameters:
      -
        in: path
        name: changeRequest_id
        description: 'The ID of the changeRequest.'
        example: consequatur
        required: true
        schema:
          type: string
  /api/v1/notifications:
    get:
      summary: 'My notifications'
      operationId: myNotifications
      description: ''
      parameters:
        -
          in: query
          name: unread
          description: 'Only unread ones.'
          example: true
          required: false
          schema:
            type: boolean
            description: 'Only unread ones.'
            example: true
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Notifications
  /api/v1/notifications/unread-count:
    get:
      summary: 'Unread count (for the badge)'
      operationId: unreadCountforTheBadge
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Notifications
  /api/v1/notifications/read-all:
    post:
      summary: 'Mark all as read'
      operationId: markAllAsRead
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Notifications
  '/api/v1/notifications/{id}/read':
    post:
      summary: 'Mark one as read'
      operationId: markOneAsRead
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Notifications
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the notification.'
        example: consequatur
        required: true
        schema:
          type: string
  '/api/v1/notifications/{id}':
    delete:
      summary: 'Delete a notification'
      operationId: deleteANotification
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Notifications
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the notification.'
        example: consequatur
        required: true
        schema:
          type: string
  /api/v1/admin/users:
    get:
      summary: 'List users'
      operationId: listUsers
      description: ''
      parameters:
        -
          in: query
          name: 'filter[status]'
          description: 'active or suspended.'
          example: consequatur
          required: false
          schema:
            type: string
            description: 'active or suspended.'
            example: consequatur
        -
          in: query
          name: 'filter[role]'
          description: ''
          example: admin
          required: false
          schema:
            type: string
            description: ''
            example: admin
        -
          in: query
          name: 'filter[search]'
          description: 'Name, email or username.'
          example: consequatur
          required: false
          schema:
            type: string
            description: 'Name, email or username.'
            example: consequatur
        -
          in: query
          name: 'filter[trashed]'
          description: 'with or only.'
          example: consequatur
          required: false
          schema:
            type: string
            description: 'with or only.'
            example: consequatur
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Users'
    post:
      summary: 'Create a user'
      operationId: createAUser
      description: "From a tree member: send `person_id`, `username`, `password` and a role (`staff_role` or `roles`).\nThe name and phone come from the person; the email is optional.\nWithout a person, send `name` and either an `email` or a `username` to sign in with."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Users'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: 'This field is required when <code>person_id</code> is not present. يجب ألا يتجاوز طول value 150 حرفاً.'
                  example: vmqeopfuudtdsufvyvddq
                  nullable: true
                email:
                  type: string
                  description: 'This field is required when none of <code>person_id</code> and <code>username</code> are present. يجب أن يكون value بريداً إلكترونياً صحيحاً. يجب ألا يتجاوز طول value 191 حرفاً.'
                  example: kunde.eloisa@example.com
                  nullable: true
                phone:
                  type: string
                  description: 'يجب ألا يتجاوز طول value 30 حرفاً.'
                  example: hfqcoynlazghdtqtqxbaj
                  nullable: true
                username:
                  type: string
                  description: ''
                  example: null
                person_id:
                  type: string
                  description: ''
                  example: null
                password:
                  type: string
                  description: ''
                  example: consequatur
                locale:
                  type: string
                  description: ''
                  example: null
                  nullable: true
                roles:
                  type: array
                  description: ''
                  example:
                    - consequatur
                  items:
                    type: string
                staff_role:
                  type: string
                  description: ''
                  example: null
              required:
                - password
  '/api/v1/admin/users/{userId}':
    get:
      summary: 'User details'
      operationId: userDetails
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Users'
    parameters:
      -
        in: path
        name: userId
        description: ''
        example: consequatur
        required: true
        schema:
          type: string
  /api/v1/admin/persons/search:
    get:
      summary: 'Find a tree member to link an account to'
      operationId: findATreeMemberToLinkAnAccountTo
      description: "Search by name, national ID (starts with) or the family's reference number.\n`linked_user_id` is set when the person already has an account (one account per person)."
      parameters:
        -
          in: query
          name: q
          description: ''
          example: محمد
          required: true
          schema:
            type: string
            description: ''
            example: محمد
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Users'
  /api/v1/admin/staff:
    get:
      summary: 'Team (managers and staff)'
      operationId: teammanagersAndStaff
      description: "The \"المشرفون وفريق العمل\" screen: the admin and every staff member with their title.\n`meta.count` is the number of members."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Users'
  /api/v1/admin/staff-roles:
    get:
      summary: 'Staff titles'
      operationId: staffTitles
      description: "The choices of the \"تعديل الدور الوظيفي\" menu, with the permissions each one gives.\n\"المدير\" (`admin`) is granted with `PUT /admin/users/{user}/roles` and only by the developer."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Users'
  '/api/v1/admin/users/{user_id}/staff-role':
    put:
      summary: 'Set staff title'
      operationId: setStaffTitle
      description: "Makes the user staff with a title (`supervisor`, `genealogy_supervisor`, `news_manager`) and gives them its permissions.\nWorks for an existing member (adding them to the team) and for changing a staff member's title."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Users'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                staff_role:
                  type: string
                  description: ''
                  example: news_manager
              required:
                - staff_role
    parameters:
      -
        in: path
        name: user_id
        description: 'The ID of the user.'
        example: 01m43erdn58sh1pmh2hfbzaqqk
        required: true
        schema:
          type: string
  '/api/v1/admin/staff/{user_id}':
    delete:
      summary: 'Remove from the team (back to an ordinary member; the account stays)'
      operationId: removeFromTheTeambackToAnOrdinaryMemberTheAccountStays
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Users'
    parameters:
      -
        in: path
        name: user_id
        description: 'The ID of the user.'
        example: 01m43erdn58sh1pmh2hfbzaqqk
        required: true
        schema:
          type: string
  '/api/v1/admin/users/{id}':
    patch:
      summary: 'Update a user'
      operationId: updateAUser
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Users'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                username:
                  type: string
                  description: ''
                  example: null
                person_id:
                  type: string
                  description: ''
                  example: null
                name:
                  type: string
                  description: 'يجب ألا يتجاوز طول value 150 حرفاً.'
                  example: vmqeopfuudtdsufvyvddq
                email:
                  type: string
                  description: 'يجب أن يكون value بريداً إلكترونياً صحيحاً. يجب ألا يتجاوز طول value 191 حرفاً.'
                  example: kunde.eloisa@example.com
                phone:
                  type: string
                  description: 'يجب ألا يتجاوز طول value 30 حرفاً.'
                  example: hfqcoynlazghdtqtqxbaj
                  nullable: true
                password:
                  type: string
                  description: ''
                  example: null
                locale:
                  type: string
                  description: ''
                  example: null
    delete:
      summary: 'Delete a user (soft)'
      operationId: deleteAUsersoft
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Users'
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the user.'
        example: 01m43erdn58sh1pmh2hfbzaqqk
        required: true
        schema:
          type: string
  '/api/v1/admin/users/{userId}/restore':
    post:
      summary: 'Restore a deleted user'
      operationId: restoreADeletedUser
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Users'
    parameters:
      -
        in: path
        name: userId
        description: ''
        example: 01m43erdn58sh1pmh2hfbzaqqk
        required: true
        schema:
          type: string
  '/api/v1/admin/users/{user_id}/suspend':
    post:
      summary: 'Suspend a user (revokes their tokens)'
      operationId: suspendAUserrevokesTheirTokens
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Users'
    parameters:
      -
        in: path
        name: user_id
        description: 'The ID of the user.'
        example: 01m43erdn58sh1pmh2hfbzaqqk
        required: true
        schema:
          type: string
  '/api/v1/admin/users/{user_id}/activate':
    post:
      summary: 'Activate a suspended user'
      operationId: activateASuspendedUser
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Users'
    parameters:
      -
        in: path
        name: user_id
        description: 'The ID of the user.'
        example: 01m43erdn58sh1pmh2hfbzaqqk
        required: true
        schema:
          type: string
  '/api/v1/admin/users/{user_id}/roles':
    put:
      summary: 'Set system roles'
      operationId: setSystemRoles
      description: 'Only `super_admin` can grant or remove `admin` / `super_admin`.'
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Users'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                roles:
                  type: array
                  description: ''
                  example:
                    - consequatur
                  items:
                    type: string
    parameters:
      -
        in: path
        name: user_id
        description: 'The ID of the user.'
        example: 01m43erdn58sh1pmh2hfbzaqqk
        required: true
        schema:
          type: string
  '/api/v1/admin/users/{user_id}/permissions':
    put:
      summary: 'Set staff permissions'
      operationId: setStaffPermissions
      description: "The user's own permissions, on top of their role. Grant `persons.direct` / `posts.direct`\nto let a staff member save without approval. Allowed values: `GET /admin/permissions` → `grantable`."
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Users'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                permissions:
                  type: array
                  description: ''
                  example:
                    - persons.create
                    - persons.update
                    - persons.direct
                    - posts.create
                  items:
                    type: string
              required:
                - permissions
    parameters:
      -
        in: path
        name: user_id
        description: 'The ID of the user.'
        example: 01m43erdn58sh1pmh2hfbzaqqk
        required: true
        schema:
          type: string
  /api/v1/admin/languages:
    get:
      summary: 'All languages (active and inactive)'
      operationId: allLanguagesactiveAndInactive
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Languages'
    post:
      summary: 'Add a language'
      operationId: addALanguage
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Languages'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                code:
                  type: string
                  description: 'Must contain only letters. يجب أن يكون طول value 2 أحرف.'
                  example: vm
                name:
                  type: string
                  description: 'يجب ألا يتجاوز طول value 50 حرفاً.'
                  example: qeopfuudtdsufvyvddqam
                native_name:
                  type: string
                  description: 'يجب ألا يتجاوز طول value 50 حرفاً.'
                  example: niihfqcoynlazghdtqtqx
                direction:
                  type: string
                  description: ''
                  example: consequatur
                is_active:
                  type: boolean
                  description: ''
                  example: false
                sort_order:
                  type: integer
                  description: 'يجب أن تكون قيمة value 0 على الأقل.'
                  example: 45
              required:
                - code
                - name
                - native_name
                - direction
  '/api/v1/admin/languages/{id}':
    patch:
      summary: 'Update / activate / make default'
      operationId: updateActivateMakeDefault
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Languages'
      requestBody:
        required: false
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: 'يجب ألا يتجاوز طول value 50 حرفاً.'
                  example: vmqeopfuudtdsufvyvddq
                native_name:
                  type: string
                  description: 'يجب ألا يتجاوز طول value 50 حرفاً.'
                  example: amniihfqcoynlazghdtqt
                direction:
                  type: string
                  description: ''
                  example: null
                is_active:
                  type: boolean
                  description: ''
                  example: false
                is_default:
                  type: boolean
                  description: 'Must be accepted.'
                  example: true
                sort_order:
                  type: integer
                  description: 'يجب أن تكون قيمة value 0 على الأقل.'
                  example: 56
    delete:
      summary: 'Delete a language (not the default one)'
      operationId: deleteALanguagenotTheDefaultOne
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Languages'
    parameters:
      -
        in: path
        name: id
        description: 'The ID of the language.'
        example: 1
        required: true
        schema:
          type: integer
  /api/v1/admin/settings:
    get:
      summary: 'All settings'
      operationId: allSettings
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Settings'
    put:
      summary: 'Update settings'
      operationId: updateSettings
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — Settings'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                settings:
                  type: array
                  description: ''
                  example:
                    -
                      key: app.name
                      value:
                        ar: 'شجرة العائلة'
                        en: 'Family Tree'
                      group: general
                      is_public: true
                  items:
                    type: object
                    properties:
                      key:
                        type: string
                        description: 'Must match the regex /^[a-z0-9_.]+$/. يجب ألا يتجاوز طول value 191 حرفاً.'
                        example: vmqeopfuudtdsufvyvddq
                      value:
                        type: string
                        description: ''
                        example: null
                      group:
                        type: string
                        description: 'يجب ألا يتجاوز طول value 50 حرفاً.'
                        example: amniihfqcoynlazghdtqt
                      is_public:
                        type: boolean
                        description: ''
                        example: true
                    required:
                      - key
              required:
                - settings
  /api/v1/admin/stats:
    get:
      summary: 'System statistics'
      operationId: systemStatistics
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — System'
  /api/v1/admin/permissions:
    get:
      summary: 'All permissions with translated labels'
      operationId: allPermissionsWithTranslatedLabels
      description: '`grantable` marks the ones an admin can give to staff with `PUT /admin/users/{user}/permissions`.'
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — System'
  /api/v1/admin/roles:
    get:
      summary: 'Roles with their permissions'
      operationId: rolesWithTheirPermissions
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - 'Admin — System'
  '/api/v1/meta/lookups/{type}':
    get:
      summary: ''
      operationId: getApiV1MetaLookupsType
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Endpoints
    parameters:
      -
        in: path
        name: type
        description: ''
        example: consequatur
        required: true
        schema:
          type: string
  '/api/v1/meta/lookups/{type}/{id}':
    get:
      summary: ''
      operationId: getApiV1MetaLookupsTypeId
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Endpoints
    parameters:
      -
        in: path
        name: type
        description: ''
        example: consequatur
        required: true
        schema:
          type: string
      -
        in: path
        name: id
        description: 'The ID of the {type}.'
        example: '1562'
        required: true
        schema:
          type: string
  '/api/v1/admin/lookups/{type}':
    post:
      summary: ''
      operationId: postApiV1AdminLookupsType
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Endpoints
    parameters:
      -
        in: path
        name: type
        description: ''
        example: consequatur
        required: true
        schema:
          type: string
  '/api/v1/admin/lookups/{type}/{id}':
    patch:
      summary: ''
      operationId: patchApiV1AdminLookupsTypeId
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Endpoints
    delete:
      summary: ''
      operationId: deleteApiV1AdminLookupsTypeId
      description: ''
      parameters:
        -
          in: header
          name: Accept-Language
          description: ''
          example: ar
          schema:
            type: string
      responses: {  }
      tags:
        - Endpoints
    parameters:
      -
        in: path
        name: type
        description: ''
        example: consequatur
        required: true
        schema:
          type: string
      -
        in: path
        name: id
        description: 'The ID of the {type}.'
        example: '1562'
        required: true
        schema:
          type: string
