# Do not edit
openapi: 3.1.0
info:
  title: Flex Persons API
  version: '2026-10-23'
  summary: Persons
servers:
  - url: https://api.flex.one
security:
  - apiKey: []
paths:
  /persons:
    get:
      summary: List persons
      tags:
        - Endpoints
      operationId: getExternalPersons
      description: |
        List persons you have permission to read, including their names, status, and organization.
        Filter by person, organization, status, or creation date.

        For public API access, requires `persons:read` in the organization. See
        [Authentication](/get-started/authentication/) for permissions and
        [Pagination & filtering](/fundamentals/pagination/) for working with lists.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                required:
                  - data
                  - metadata
                properties:
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/PersonItem'
                  metadata:
                    $ref: '#/components/schemas/PersonListMetadata'
              example:
                data:
                  - id: 92608f75-a040-4341-a49d-f0de8daacdf1
                    organizationId: 3f8bbfa2-9257-4a7e-86d3-df1797b8e143
                    status: active
                    givenName: Alex
                    familyName: Morgan
                    displayName: Alex Morgan
                    createdAt: '2026-08-01T14:00:00.000Z'
                    lastModifiedAt: '2026-08-02T15:30:00.000Z'
                metadata:
                  pageSize: 25
                  sort: desc
        '400':
          description: A filter or pagination value is invalid, or the pagination cursor can no longer be resolved.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PersonRequestError'
        '401':
          description: Missing or invalid authentication.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PersonRequestError'
        '403':
          description: You do not have permission to read persons in a requested organization, or have no person read access.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PersonRequestError'
        '429':
          description: The rate limit was exceeded. The `Retry-After` header gives the wait time in seconds.
      parameters:
        - in: query
          name: ids
          schema:
            type: array
            maxItems: 100
            items:
              type: string
              format: uuid
          style: form
          explode: true
          description: Filter by exact person IDs. Accepts up to 100 IDs.
        - in: query
          name: organizationIds
          schema:
            type: array
            maxItems: 100
            items:
              type: string
              format: uuid
          style: form
          explode: true
          description: |
            Filter by organization IDs. Accepts up to 100 IDs. Each organization must be within your
            permitted scope; requesting an organization outside that scope returns `403`.
        - in: query
          name: statuses
          schema:
            type: array
            maxItems: 3
            items:
              $ref: '#/components/schemas/PersonStatus'
          style: form
          explode: true
          description: Filter by person status. Accepts up to three values; includes all statuses when omitted.
        - in: query
          name: createdAtGte
          schema:
            type: string
            format: date-time
          description: Include persons created at or after this timestamp (inclusive).
        - in: query
          name: createdAtLte
          schema:
            type: string
            format: date-time
          description: Include persons created at or before this timestamp (inclusive).
        - in: query
          name: nextToken
          schema:
            type: string
            maxLength: 64
          description: |
            Cursor for the next page. See [Pagination & filtering](/fundamentals/pagination/).
            Returns `400` if the cursor is malformed or its person record is no longer visible to you.
        - in: query
          name: pageSize
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 25
          description: Maximum number of persons per page, from 1 to 100. Defaults to 25.
        - in: query
          name: sort
          schema:
            type: string
            enum:
              - asc
              - desc
            default: desc
          description: Sort direction; `asc` returns oldest first and `desc` returns newest first. Defaults to `desc`.
        - in: query
          name: sortBy
          schema:
            type: string
            enum:
              - createdAt
            default: createdAt
          description: Field to sort by. Only `createdAt` is supported and is the default.
        - $ref: '#/components/parameters/flexVersion'
  /persons/{personId}:
    get:
      summary: Get person
      tags:
        - Endpoints
      operationId: getExternalPerson
      description: |
        Retrieve a person's name, status, and organization by ID. You must have permission to read
        that person.

        For public API access, requires `persons:read` in the organization. See
        [Authentication](/get-started/authentication/) for permissions and
        [Errors](/fundamentals/errors/) for error responses.
      parameters:
        - in: path
          name: personId
          required: true
          schema:
            type: string
            format: uuid
          description: The ID of the person to retrieve.
        - $ref: '#/components/parameters/flexVersion'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PersonItem'
              example:
                id: 92608f75-a040-4341-a49d-f0de8daacdf1
                organizationId: 3f8bbfa2-9257-4a7e-86d3-df1797b8e143
                status: active
                givenName: Alex
                familyName: Morgan
                displayName: Alex Morgan
                createdAt: '2026-08-01T14:00:00.000Z'
                lastModifiedAt: '2026-08-02T15:30:00.000Z'
        '400':
          description: The person ID is not a valid UUID.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PersonRequestError'
        '401':
          description: Missing or invalid authentication.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PersonRequestError'
        '403':
          description: You have no person read access or lack the organization or person identity required to authorize the request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PersonRequestError'
        '404':
          description: No person with this ID is visible within your permitted scope. Authorization failures return `403` before this lookup.
        '429':
          description: The rate limit was exceeded. The `Retry-After` header gives the wait time in seconds.
components:
  securitySchemes:
    apiKey:
      type: http
      scheme: bearer
  parameters:
    flexVersion:
      in: header
      name: flex-version
      required: false
      example: '2026-10-23'
      schema:
        type: string
        pattern: ^\d{4}-\d{2}-\d{2}$
  schemas:
    PersonItem:
      title: PersonItem
      type: object
      description: |
        A person's name, status, organization, and record timestamps. Does not include contact details,
        date of birth, tax ID, or identity documents.
      required:
        - id
        - organizationId
        - status
        - createdAt
        - lastModifiedAt
      properties:
        id:
          type: string
          format: uuid
          description: |
            The person's ID within their organization. Use this as `cardholderId` when
            [creating a card](/reference/cards/create-card/) for this person.
        organizationId:
          type: string
          format: uuid
          description: The ID of the organization this person record belongs to.
        status:
          $ref: '#/components/schemas/PersonStatus'
        givenName:
          type: string
          description: The person's given name, when on file.
        familyName:
          type: string
          description: The person's family name, when on file.
        displayName:
          type: string
          description: |
            The name to display, when on file. If omitted, use the available `givenName` and `familyName`.
        createdAt:
          type: string
          format: date-time
          description: When this person record was created.
        lastModifiedAt:
          type: string
          format: date-time
          description: When this person record was last updated.
    PersonListMetadata:
      title: PersonListMetadata
      type: object
      required:
        - pageSize
        - sort
      properties:
        pageSize:
          type: integer
          description: The requested maximum number of persons per page.
        sort:
          type: string
          description: The applied sort direction; `asc` is oldest first and `desc` is newest first.
          enum:
            - asc
            - desc
        nextToken:
          type: string
          description: Cursor for the next page, omitted on the last page. See [Pagination & filtering](/fundamentals/pagination/).
    PersonRequestError:
      title: PersonRequestError
      type: object
      description: |
        Error body for rejected requests. `errors` is keyed by the offending
        field (or `message` for request-level problems). `flexErrorCode` is a
        stable machine-readable code, present on the errors that carry one.
      required:
        - statusCode
        - message
      properties:
        statusCode:
          type: integer
        message:
          type: string
        errors:
          type: object
          additionalProperties:
            type: string
        flexErrorCode:
          type: string
    PersonStatus:
      title: PersonStatus
      type: string
      description: |
        The person's status in the organization. `active` means active membership, `inactive` means
        suspended membership, and `removed` means the person has been removed from the organization.
      enum:
        - active
        - inactive
        - removed
tags:
  - name: Endpoints
