openapi: 3.0.0
servers:
  - url: https://YOUR_DOMAIN
    description: Server URL
tags:
  - name: OAuth
  - name: Passwordless
    x-displayName: "Passwordless"
    description: |
      This section contains all passwordless operations for the Management API.
  - name: Users
    x-displayName: "Users"
    description: |-
      With the Management API, you can perform a multitide of operations on your users including logging in as a user, updating, searching, and even merging users.

      **Filtering**

      Using the [Filtering](#section/Filtering) feature of the Management API, you can filter most fields in the [user profile object](https://developer.reachfive.com/docs/models-user-profile.html#the-user-profile-object).

      Here is an example to get you started:

      ```curl
      GET `api/v2/users?filter=addresses.locality IN ("Marseille") AND created_at SINCE "14d"&fields=name,gender,consents
      ```

      The operation above searches for users located in Marseille that were created in the last 14 days. It also returns only the name, gender, and consents fields.

  - name: Addresses
  - name: MFA
    x-displayName: "Multi-factor Authentication"
    description: |
      Multi-factor Authentication (MFA) requires users to provide two or more verification factors to get access to a resource such as an application, online account, or when making a payment.
      It is an important component of a strong customer identity and access management policy particularly when payments are involved.
  - name: API Clients
  - name: Custom Field Schemas
    x-displayName: "Custom Field Schemas"
    description: |
      You can create, update, retrieve, and remove custom field schemas using the Custom Fields Schema API.

      > **Important**: The generic custom field schema API is now deprecated. Please see the [Profile custom field schema](#tag/Profile-custom-field-schemas) and [Address custom field schema](#tag/Address-custom-field-schemas) endpoints.
  - name: Profile custom field schemas
    x-displayName: "Profile custom Field Schemas"
    description: |
      You can create, update, retrieve, and remove profile custom field schemas using the Custom Fields Schema API.
  - name: Address custom field schemas
    x-displayName: "Address custom Field Schemas"
    description: |
      You can create, update, retrieve, and remove address custom field schemas using the Custom Fields Schema API.
  - name: User events
  - name: Consents
    description: |
      Endpoints to manage consents including standalone consents, consent groups, and double opt-in (DOI) consents.
  - name: Clients
  - name: Audit Logs
    description:
      Audit logs document changes in a system. In the case of ReachFive, audit logs capture when certain events occur in your ReachFive account.
  - name: JWK Sets
    description: |
      A JSON Web Key Set (JWKS) is a set of keys that contain the public keys needed to verify JSON Web Tokens (JWT). These JWTs are issued by the authorization server and signed using the RS256 signing algorithm.

      Using the Management API, you can retrieve, sync, and rotate these JSON Web Keys globally and by client.

      **Note**: See [RFC7517](https://tools.ietf.org/html/rfc7517#section-5) for more details.
  - name: Jobs
  - name: Grants
    x-displayName: "Grants"
    description: |
      View and manage authorizations to third-party sites.

      **Note**: Users can use the [Identity API](https://developer.reachfive.com/api/identity.html#tag/Grants) if they are connected and have a first-party access token.
  - name: AuthDescription
    x-displayName: "Overview"
    description: |-
      To connect to the Management API, you must first obtain an access token.

      Such tokens are obtained by calling [/oauth/token](#operation/retrieveAccessToken) endpoint.
      with your `client ID` and `client secret`, available in the ReachFive console.

      ```
      POST https://YOUR_DOMAIN/oauth/token
      {
        "grant_type": "client_credentials",
        "client_id": "{{management_client_id}}",
        "client_secret": "{{management_client_secret}}",
        "scope": "{{space-separated list of scopes}}",
      }
      ```

      The `redirect_uri` be added to the `Allowed Callback URLs` field in your client.

      Required scopes are listed next to each endpoint.

x-tagGroups:
  - name: Authentication
    tags:
      - AuthDescription
      - OAuth
      - MFA
  - name: User Management
    tags:
      - Addresses
      - Grants
      - IPs
      - Users
      - User events
      - Passwordless
  - name: Custom field schemas
    tags:
      - Profile custom field schemas
      - Address custom field schemas
      - Custom Field Schemas
  - name: Account Configuration
    tags:
      - Consents
      - Clients
      - JWK Sets
      - Audit Logs
  - name: Jobs
    tags:
      - Jobs and job definitions
info:
  description: |
    # Introduction
    Welcome to the documentation reference for the ReachFive REST Management API!

    This API is documented in **OpenAPI standard**, and rendered using [ReDoc](https://github.com/Redocly/redoc).

    If something is missing, incorrect, or unclear, reach us at <documentation@reach5.co>.

    # Environment
    Endpoints are available at `https://{YOUR_DOMAIN}{ENDPOINT}`.

    Find how to obtain your ReachFive domain [here](https://developer.reachfive.com/docs/console.html#access-your-reachfive-console).

    # Selecting fields

    By default, all fields of an object are returned when you make a query.

    You can choose the specific fields that you want returned with the `fields` query parameter as shown in the example below. 

    You can also select sub-fields by passing a full stop (_period_) after the field. This is shown in `email.unverified` parameter example.

    **Note**: Pass multiple query parameters by separating each parameter with a comma.

    ```
    GET /api/v2/users/AVqvOB58Fg6nZfQ0ZqXt?fields=id,name,email,email.unverified
    ```

    ```
    {
      "id": "AVqvOB58Fg6nZfQ0ZqXt",
      "name": "John Doe",
      "email": "john.doe@example.com"
      "emails": {
        "unverified":[
          "johnny-joe.doe@example.com"
        ]
      }
    }
    ```

    # Sorting

    You can sort the API response by certain fields using the `:asc` (ascending) or `:desc` (descending) operators in your API call. The example
    below shows the operation being sorted in descending order by `email`.

    ```
    GET /api/v2/users?fields=id,name,email&sort=email:desc
    ```

    > **Important**: You can't sort all fields. Check out which fields you can sort in the [User Profile Object page](https://developer.reachfive.com/docs/models-user-profile.html#user-profile-fields).

    # Searching

    Return only matching data for the following fields:

    - `name`
    - `email`
    - `phoneNumber`
    - `externalId`
    - `customIdentifier`
    
    The search is case insensitive, and uses query tokens as prefixes (i.e., the name `John Doe` would appear among the results of the queries `Joh`, `doe` or `Joh doe`).

    > **Note**: As of now, you cannot search special characters (*characters that are not alphanumeric*).

    > **Important**: There is a results limit of 10k in the search response. If you need to see more than 10k results, we recommend [Exporting the data](https://developer.reachfive.com/docs/user-exports.html).

    ```
    GET /api/v2/users?q="john"
    ```

    ```
    {
      "total": 2,
      "items": [
        {
          "id": "AVqvOB58Fg6nZfQ0ZqXt",
          "name": "John Doe",
          "email": "john.doe@example.com"
        },
        {
          "id": "AW3mOB19Cg284ZfL0ZkLp",
          "name": "John Dale",
          "email": "john.dale@outlook.com"
        }
      ]
    }
    ```

    # Filtering
    Some endpoints support results filtering, using the `filter` parameter.

    The search is made of a series of terms which are composed of a field, an operator, and possibly a value:

    `{field} {operator} {value?}`

    If you have multiple terms, they must be separated by the `AND` operator — `OR` is not supported yet.

    ```bash
    GET /api/v2/users?filter=age%20%3E%3D%2030%20AND%20age%20%3C%2040%20AND%20gender%20%3D%3D%20%22female%22&fields=id,name
    ```

    ```
    {
      "total": 58,
      "items": [
        {
          "id": "AVqvOB58Fg6nZfQ0ZqXt",
          "name": "Elizabeth Smith"
        },
        {
          "id": "AWYMQlcj302KtelmOfp1",
          "name": "Julia Carter"
        },
        ...
      ]
    }
    ```

    ## Equality operator

    You can search for exact matches by using the equality operator `==`.

    **Examples**:

    * `?filter=email == "john.doe@example.com"`
    * `?filter=age == 30`
    * `?filter=email_verified == true`
    * `?filter=family_name == mill`

    > **Note**: 
    > 
    > The exact match occurs on each term in the field and not the whole field. It is not case sensitive.
    >
    > **Example:**
    > 
    > *Search*: 
    > `?filter=family_name == "Mill"`
    >
    > *Sample results:*
    > `Mill de Tolos`, `Mill`, `Mc Mill er`, `mill`, `mill son`

    ## Inclusion

    You can filter a field by multiple values with the `IN` operator.

    When applied to a collection, there must be at least one matching item.

    `identities.provider IN ("facebook", "google")`

    ## Exclusion

    You can filter a field by multiple values with the `NOT IN` operator. When applied to a collection, all items must not match.

    `identities.provider NOT IN ("facebook", "google")`

    ## Existence

    You can check for the presence of a field using the `EXISTS` operator. It checks whether a certain field is defined (i.e. it has any value).

    If the field is not defined, it will not be present in the JSON payload and the operator will consider it non-existent.

    **Example**:

    `phone_number EXISTS`

    ## Absence

    You can check for the absence of a field using the `MISSING` operator.

    It checks whether a certain field is not defined (i.e. it has no value).

    Example:

    `given_name MISSING`

    ## Ranges

    The following range operators, applicable to date and number fields, are available:

    * `<`: Less than.
    * `<=`: Less than or equal to.
    * `>`: Greater than.
    * `>=`: Greater than or equal to.

    **Examples**:

    * `age >= 30 AND age < 40`
    * `last_login >= "2018-01-01"`

    ## SINCE
    
    The `SINCE` range operator is also available for date and datetime fields: `SINCE` returns the activity in the specified time range in seconds, minutes, hours, or days.
    
    **Note**: For dates, only days is applicable.

    **Examples**:

    When assigning a value to the `SINCE` range operator, make sure the value is enclosed in double quotes `"<value>"` as shown below.

    * `last_login SINCE "30s"`
    * `last_login SINCE "1min"`
    * `last_login SINCE "1h"`
    * `last_login SINCE "7d"`

    ## BEFORE
    
    The `BEFORE` range operator is also available for date and datetime fields: `BEFORE` returns the activity that occurred **before** the value. So, for example, if 
    we say `BEFORE 14d`, we get values that exclude the last 14 days.
    
    **Note**: For dates, only days is applicable.

    **Examples**:

    When assigning a value to the `BEFORE` range operator, make sure the value is enclosed in double quotes `"<value>"` as shown below.

    * `last_login BEFORE "7d"`

    ## Text search

    You can search for partial matching in your text fields with the following operators:

    * `CONTAINS`: Checks if the field contains some text
    * `STARTS WITH`: Checks if the field starts with a specific text
    * `ENDS WITH`: Checks if the field ends with a specific text

    Examples:

    * `email CONTAINS "john"`
    * `email ENDS WITH "@gmail.com"`
    * `email STARTS WITH "john.doe"`

    # Errors

    The API uses standard HTTP status codes to indicate the success or failure of the API call.

    |Code   |Notes                                                                                           |
    |-------|------------------------------------------------------------------------------------------------|
    |`2xx`  | Success codes; indicates the request worked as expected.                                  |
    |`4xx`  | Error codes; indicates a client (user) error and more information is provided. See the example below.       |
    |`5xx`  | Server error codes; indicates an error with one of ReachFive's servers.                        |      

    The error body is JSON and contains the following fields:

    ```
    {
        "error_id": "2hNBbvYecw",
        "error_description": "Invalid email or password",
        "error_message_key": "error.invalidEmailOrPassword",
        "error": "invalid_grant",
        "error_user_msg": "Invalid email or password"
    }
    ```

    - `error_id` is the auto-generated ID of the error.
    - `error_description` is the default error description.
    - `error_message_key` is the unique key that can be used to bind specific behaviors on other services. This also acts as the `i18n` translation key.
    - `error` is the error type. See the Error Types table below for more details.
    - `error_user_msg` is a user-friendly error message that should be used in the UI. This can be overriden in certain configurations. 

    |Error Type|
    |----------|
    |`server_error`|
    |`invalid_request`|
    |`invalid_state`|
    |`invalid_grant`|
    |`invalid_scope`|
    |`insufficient_scope`|
    |`access_denied`|
    |`origin_not_allowed`|
    |`ip_address_not_allowed`|
    |`missing_config`|
    |`invalid_config`|
    |`resource_not_found`|
    |`temporarily_unavailable`|
    |`unsupported_grant_type`|
    |`unsupported_algorithm`|
    |`invalid_client`|
    |`unauthorized_client`|
    |`login_required`|
    |`email_already_exists`|
    |`external_id_already_exists`|
    |`phone_number_already_exists`|
    |`lite_profile_invalid_identifiers`|
    |`lite_profile_missing_profile`|
    |`password_too_weak`|
    |`rate_limit_reached`|
    |`webhook_host_unreachable`|
    |`webhook_invalid_response`|

    **Tip**: For more information, see the individual endpoints.

  version: 'latest'
  title: ReachFive Management API
  termsOfService: https://www.reachfive.com/terms-policies
  contact:
    name: Email
    email: documentation@reach5.co
    # url: http://www.reachfive.com/contact
  x-logo:
    url: _images/management-api.png
    altText: OpenAPI Specification
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
# externalDocs:
#   description: Find out more information at this link
#   url: https://github.com/Rebilly/generator-openapi-repo
paths:
  /api/v2/users/{userId}/login-as:
    get:
      security:
        - OAuth2:
          - 'manage:users'
      tags:
        - Users
      summary: Login as
      description: |
        Log in as a specific user.
        
        Return a redirect URL containing either a `code` or `access_token` (*depending on your settings and/or query parameter*).

        **Note**: The "Login as" feature must be enabled and configured on your Reachfive account. See [the Login as guide](https://developer.reachfive.com/docs/login-as.html) for more information.
      operationId: loginAs
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
        - $ref: '#/components/parameters/clientIdQuery'
        - $ref: '#/components/parameters/responseType'
        - $ref: '#/components/parameters/redirectUrl'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  redirectUrl:
                    type: string
                    description: A redirect URL.
              example:
                  redirectUrl: "https://YOUR_DOMAIN/identity/v1/password/callback"
        '400':
          description: | 
            Bad request.
            This typically means:
              - you're missing required query parameters (dynamic login as mode).
              - you're missing the required login as settings (standard login as mode)
        '404':
          description: User not found.
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v2/users/USER_ID/login-as \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v2/users:
    post:
      security:
        - OAuth2:
          - 'manage:users'
      tags:
        - Users
      summary: Create a new user
      description: |
       Create the specified user by setting the values of the object's properties passed. One of the following attributes is mandatory:

       * `email`
       * `phone_number`

       The user attributes that can be set at the root levels are listed below.
      operationId: createUser
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProfileFields'
            example: {
              "name": Robert Zane,
              "email": rzane@lawfirm.com,
              "gender": "male",
              "birthdate": "1967-10-13"
            }
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/fields'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
              example:
                id: AVqvOB58Fg6nZfQ0ZqXt
                name: John Doe
                email: johndoe@example.com
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v2/users?fields=name,email,gender,birthdate \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                  "name": "Robert Zane",
                  "email": "rzane@lawfirm.com",
                  "gender": "male",
                  "birthdate": "1967-10-13"
                }'
    get:
      security:
        - OAuth2:
          - 'read:users'
      summary: Search users
      tags:
        - Users
      description: |
        Retrieves a list of users.

        > **Important**: There is a results limit of 10k in the search response.
        > **Tip**: If you need to see more than 10k results, we recommend [Exporting the data](https://developer.reachfive.com/docs/user-exports.html).

        Using the [Filtering](#section/Filtering) feature of the Management API, you can filter any of the fields in the [user profile object](https://developer.reachfive.com/docs/models-user-profile.html#the-user-profile-object).

        Here are a few examples to get you started:

        **Example 1: Search by filtering user location**
        
        Searches for users located in Marseille that were created in the last 14 days. It also returns only the name, gender, and consents fields.

        ```curl
        GET `api/v2/users?filter=addresses.locality IN ("Marseille") AND created_at SINCE "14d"&fields=name,gender,consents
        ```

        **Example 2: Search by filtering user suspension status**
        
        Searches for permanently suspended users. Simply replace `permanent` with `temporary` to search for temporarily suspended users.

        *Tip:* See the [User suspension guide](https://developer.reachfive.com/docs/suspend-user.html) for more details.

        ```curl
        GET `api/v2/users?filter=suspension_status=="permanent"
        ```

        **Example 3: Search by filtering custom fields**

        Searches users with a `custom_field`.

        *Tip:* See the [Custom fields guide](https://developer.reachfive.com/docs/custom-fields.html) for more details.

        ```curl
        GET `api/v2/users?filter=email=="jmell@example.com"&extendedFields=custom.fields
        ```
        

      operationId: searchUsers
      parameters:
        - $ref: '#/components/parameters/fields'
        - $ref: '#/components/parameters/filter'
        - $ref: '#/components/parameters/extendedFields'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/count'
        - $ref: '#/components/parameters/sort'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  total:
                    type: string
                    description: The total number of items in the response.
                    example: "1"
                  items:
                    description: |
                      An array of objects containing the search response. The number of objects here matches the number in `total`.

                      In this example, we imagine using the `fields` query parameter to return `name`, `email`, `phone_number`, and `gender`.
                    type: array
                    items:
                      type: object
                      properties:
                        name:
                          type: string
                          description: The name of the user.
                          example: "Lionel"
                        gender:
                          type: string
                          description: The gender of the user.
                          example: "male"
                        phone_number:
                          type: string
                          description: The user's phone number.
                          example: "+353871234567"
                        email:
                          type: string
                          description: The user's email.
                          example: "lionel@example.com"
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v2/users?fields=name,email,gender,birthdate \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                  "name": "Robert Zane",
                  "email": "rzane@lawfirm.com",
                  "gender": "male",
                  "birthdate": "1967-10-13"
                }'
  /oauth/token:
    post:
      summary: Retrieve an access token
      tags:
        - OAuth
      description: Retrieve an access token.
      operationId: retrieveAccessToken
      requestBody:
        description: ''
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                grant_type:
                  description: OAuth2 grant type. Always use `client_credentials`
                  type: string
                client_id:
                  description: Your ReachFive client ID.
                  type: string
                client_secret:
                  description: Your ReachFive client secret.
                  type: string
                scope:
                  description: Space-delimited list of permissions. The required permissions are documented for each API endpoint.
                  type: string
              required:
                - grant_type
                - client_id
                - client_secret
                - scope
              example:
                grant_type: "client_credentials"
                client_id: "YOUR_CLIENT_ID"
                client_secret: "YOUR_CLIENT_SECRET"
                scope: "read:users manage:users"
      responses:
        '200':
          description: Successfully retrieved the access token.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/retrieveAccessTokenResponse'
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/oauth/token \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                "grant_type": "client_credentials",
                "client_id": "YOUR_CLIENT_ID",
                "client_secret": "YOUR_CLIENT_SECRET",
                "scope": "read:users manage:users"
              }'
  /api/v2/users/{user_id}/facebook-likes:
    get:
      security:
        - OAuth2:
          - 'read:facebook-likes'
      tags:
        - Users
      summary: Get user Facebook likes
      description: Retrieves a user's Facebook likes.
      operationId: getUserFacebookLikes
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
      responses:
        '200':
          description: Returns an object containing an array of liked pages, each being its own object.
          content:
            application/json:
              schema:
                type: object
                properties:
                  total:
                    type: integer
                    description: The total number of Facebook likes associated with the specified user.
                  items:
                    type: object
                    description: An array of objects containing each Facebook like.
                    properties:
                      page_id:
                        type: string
                        description: The ID of the page which the user liked.
                      name:
                        type: string
                        description: The name of the page which the user liked.
                      created_at:
                        type: string
                        format: date-time
                        description: The time at which the user liked the page.
              example:
                  {
                      "total": 308,
                      "items": [
                          {
                              "page_id": "102775078333036",
                              "name": "SnowFlake3D",
                              "created_at": "2020-12-04T21:03:53.000Z"
                          },

                          {
                              "page_id": "1257790464367673",
                              "name": "Burger Quiz",
                              "created_at": "2018-05-08T16:38:37.000Z"
                          }
                      ]
                  }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v2/users/USER_ID/facebook-likes \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v2/users/{user_id}:
    get:
      security:
        - OAuth2:
          - 'read:users'
      tags:
        - Users
      summary: Get a user
      description: |
        Retrieves the details of an existing customer.

      operationId: getUser
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
        - $ref: '#/components/parameters/fields'
        - $ref: '#/components/parameters/extendedFields'
      responses:
        '200':
          description: Returns the [user object](https://developer.reachfive.com/docs/models-user-profile.html#the-user-profile-object).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProfileFields'
              example:
                email: johndoe@example.com
                gender: male
                birthdate: '1970-01-01'
        '4XX':
          description: Returns an error if parameters are invalid (e.g. specifying an invalid user id).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFields'
              example:
                error_id: Ll18zIPMPK
                error_description: User not found
                error_message_key: error.user.notFound
                error: resource_not_found
                error_user_msg: User not found
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v2/users/USER_ID?fields=email,gender,birthdate \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
    put:
      security:
        - OAuth2:
          - 'manage:users'
      summary: Update a user
      tags:
        - Users
      description: |
        Updates the specified user by setting the values of the object's properties passed.

        Any root properties (or custom fields) not provided will be left unchanged.

        > **Note**: The properties of the new object will replace the old ones except for `custom_fields` attribute that is merged.

        > **Tip**: You can override the default email confirmation `redirect_url` with an optional `redirect_url` parameter in the request body.
      operationId: updateUser
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
        - $ref: '#/components/parameters/fields'
      requestBody:
        description:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/updateUserFields'
      responses:
        '200':
          description: Return the user object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/updateUserFields'
        '400':
          description: Bad request. Email already in use.
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request PUT \
              --url https://YOUR_DOMAIN/api/v2/users/USER_ID?fields=email,gender,birthdate \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                "birthdate": "1981-10-13",
                "nickname": null,
                "custom_fields": {
                "fidelity_card": 1198433
              }'
    delete:
      security:
        - OAuth2:
          - 'manage:users'
      summary: Delete a user
      tags:
        - Users
      description: |
        Delete user and all related data definitely.

        We retain the [`user_deleted` event type](https://developer.reachfive.com/docs/models-user-events.html#user-event-types) for a certain period of time after a user profile is deleted.

      operationId: deleteUser
      parameters:
        - in: query
          name: keepLiteProfile
          required: false
          schema:
            type: string
            example: false
          description: Defines whether or not to keep lite profile information when deleting the user.
        - in: path
          name: user_id
          required: true
          schema:
            type: string
            example: AVqvOB58Fg6nZfQ0ZqXt
          description: ID of the user to delete.
        - $ref: '#/components/parameters/Authorization'
      responses:
        '204':
          description: User was deleted
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request DELETE \
              --url https://YOUR_DOMAIN/api/v2/users/USER_ID? \
                keepLiteProfile=false \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v2/users/{user_id}/mfa/trusteddevices:
    get:
      summary: View user's trusted devices
      tags:
        - MFA
      security:
        - OAuth2:
          - 'read:mfa'
      description: |
        View a user's list of trusted devices.
      operationId: getTrustedDevices
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - in: path
          name: user_id
          required: true
          schema:
            type: string
            example: AVqvOB..Q0ZqXt
          description: The ID of the user whose second trusted devices you want to view.
      responses:
        '200':
          description: Success. Shows trusted devices associated with the user.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getTrustedDevicesResponse'
      x-codeSamples:
      - lang: 'cURL'
        source: |
          curl --request GET \
            --url https://YOUR_DOMAIN//api/v2/users/{user_id}/mfa/trusteddevices \
            --header 'Authorization: Bearer eyJ0eX...ll4Q2NT' \
  /api/v2/users/{user_id}/mfa/trusteddevices/{trusted_device_id}:
    delete:
      summary: Delete a user's trusted device
      tags:
        - MFA
      security:
        - OAuth2:
          - 'manage:mfa'
      description: |
        Remove a trusted device for a user.
      operationId: deleteTrustedDevices
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - in: path
          name: user_id
          required: true
          schema:
            type: string
            example: AVqvOB..Q0ZqXt
          description: The ID of the user whose second trusted devices you want to view.
        - in: path
          name: trusted_device_id
          required: true
          schema:
            type: string
            example: zVqvOB..Q0ZqXt
          description: The ID of the trusted device you want to remove.
      responses:
        '204':
          description: Success. Trusted device removed.
      x-codeSamples:
      - lang: 'cURL'
        source: |
          curl --request DELETE \
            --url https://YOUR_DOMAIN//api/v2/users/{user_id}/mfa/trusteddevices/{trusted_device_id} \
            --header 'Authorization: Bearer eyJ0eX...ll4Q2NT' \
  /api/v2/users/{user_id}/mfa/credentials/phone-numbers:
    post:
      summary: Register the phone number for MFA
      tags:
        - MFA
      security:
        - OAuth2:
          - 'manage:users'
          - 'manage:mfa'
      description: |
        Start the registration of a phone number as an MFA credential (second factor).


        > #### <i class="fa fa-gear fa-spin fa-2x" style="color: #00c24a"></i> What Next?
        > Users will need to [verify their phone number for MFA usage](#operation/verifyPhoneNumberRegistration) with the code received. However, the administrator comples the 
        Management MFA flow.
      operationId: startPhoneNumberRegistration
      parameters:
        - $ref: '#/components/parameters/Authorization'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                  phone_number:
                    description: The phone number used as a second factor. It doesn't have to be the same as the identifier.
                    type: string
                    example: "+33612345678"
              required:
               - phone_number  
      responses:
        '204':
          description: Sends a verification code to the provided phone number.
      x-codeSamples:
      - lang: 'cURL'
        source: |
          curl --request POST \
            --url https://YOUR_DOMAIN/api/v2/mfa/credentials/phone-numbers \
            --header 'Content-Type: application/json' \
            --header 'Authorization: Bearer eyJ0eX...ll4Q2NT' \
            --data '{
                "phone_number": "+33612345678"
            }'
  /api/v2/users/{user_id}/mfa/credentials/phone-numbers/verify:
    post:
      summary: Verify the phone number for MFA
      tags:
        - MFA
      security:
        - OAuth2:
          - 'manage:users'
          - 'manage:mfa'
      description: |
        Complete the registration of the phone number used as an MFA credential (second factor) by verifying it with the code received by SMS.
        
        > #### <i class="fa fa-gear fa-spin fa-2x" style="color: #00c24a"></i> What Next?
        > Once a user's number is verified for MFA, the number can be used as a second factor in the [step up flow](https://developer.reachfive.com/openapi/identity.html#operation/stepup).
      operationId: verifyPhoneNumberRegistration
      parameters:
        - $ref: '#/components/parameters/Authorization'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                  verification_code:
                    description: The verification code sent by SMS.
                    type: integer
                    pattern: "[0-9]{6}"
                    example: 123456
              required:
                - verification_code
      responses:
        '204':
          description: Verifies the phone number used as a second factor.
      x-codeSamples:
      - lang: 'cURL'
        source: |
          curl --request POST \
            --url https://YOUR_DOMAIN/api/v2/mfa/credentials/phone-numbers/verify \
            --header 'Content-Type: application/json' \
            --header 'Authorization: Bearer eyJ0eX...ll4Q2NT' \
            --data '{
                "verification_code": "123456"
            }'    
  /api/v2/users/{user_id}/mfa/credentials/email:
    delete:
      summary: Delete MFA credentials (email)
      tags:
        - MFA
      security:
        - OAuth2:
          - 'manage:users'
          - 'manage:mfa'
      operationId: deleteMFAemail
      description: Removes the user's email for use as an MFA (second factor) credential.
      parameters:
        - $ref: '#/components/parameters/Authorization'
      responses:
        '204':
          description: OK
        '400':
          description: Bad request. User has no MFA email credential.
      x-codeSamples:
      - lang: 'cURL'
        source: |
          curl --request DELETE \
            --url https://YOUR_DOMAIN/api/v2/users/{user_id}/mfa/credentials/emails \
            --header 'Accept: application/json' \
            --header 'Authorization: Bearer eyJ0eX...ll4Q2NT' \
    post:
      summary: Enable the identifier email for MFA
      tags:
        - MFA
      security:
        - OAuth2:
          - 'manage:users'
          - 'manage:mfa'
      operationId: startEmailRegistration
      description: |
        Starts the activation of an identifier email as an MFA credential (second factor). If the user does not have an email as an identifier, one must be added before using this route.

        > #### <i class="fa fa-gear fa-spin fa-2x" style="color: #00c24a"></i> What Next?
        > When using this route, users receive their `verification_code`. It should be used as the request payload for [verifying MFA registration](#operation/verifyEmailRegistration).
      
      parameters:
        - $ref: '#/components/parameters/Authorization'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                  redirect_url:
                    description: |
                      The URL to redirect the user verifying the email address.

                      **Note**: This is not required if you have set the *Redirect to* field in the console.
                      However, if you have not done this, you must pass the `redirect_url` in the request body.
                    type: string
                    example: "https://www.example.com/redirect" 
      responses:
        '202':
          description: A success confirming the email was sent to the user for verification.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: The status of whether the email was sent or not.
                    example: "email_sent"
      x-codeSamples:
      - lang: 'cURL'
        source: |
          curl --request POST \
            --url https://YOUR_DOMAIN/api/v2/mfa/credentials/emails \
            --header 'Content-Type: application/json' \
            --header 'Authorization: Bearer eyJ0eX...ll4Q2NT' \
            --data '{
                "redirect_url": "https://www.example.com/redirect"
            }'
  /api/v2/users/{user_id}/mfa/credentials/emails/verify:
    post:
      summary: Verify the email for MFA
      tags:
        - MFA
      security:
        - OAuth2:
          - 'manage:users'
          - 'manage:mfa'
      operationId: verifyEmailRegistration
      description: |
        Verifies the registration of an email as an MFA credential (second factor).

        **Important**: The administrator can complete the Management MFA flow with this `post` route, but users can also complete the flow by clicking the magic link in the email (if the magic link is configured to appear in the email).

        > #### <i class="fa fa-gear fa-spin fa-2x" style="color: #00c24a"></i> What Next?
        > Once a user's email is verified for MFA, the email can be used as a second factor to initiate the [step up flow](https://developer.reachfive.com/openapi/identity.html#operation/stepup).
      parameters:
        - $ref: '#/components/parameters/Authorization'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                  verification_code:
                    description: The verification code sent by email.
                    type: integer
                    pattern: "[0-9]{6}"
                    example: 123456
              required:
                - verification_code
      responses:
        '204':
          description: The email used as a second factor has been successfully verified.
      x-codeSamples:
      - lang: 'cURL'
        source: |
          curl --request POST \
            --url https://YOUR_DOMAIN/api/v2/mfa/credentials/emails/verify \
            --header 'Content-Type: application/json' \
            --header 'Authorization: Bearer eyJ0eX...ll4Q2NT' \
            --data '{
                "verification_code": "123456"
            }'  
  /api/v2/users/{user_id}/mfa/credentials:
    get:
      summary: List MFA credentials
      tags:
        - MFA
      security:
        - OAuth2:
          - 'read:users'
          - 'read:mfa'
      description: Lists the user credentials that have been added as a second factor (MFA) to their profile.
      operationId: listMfaCredentials
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - in: path
          name: user_id
          required: true
          schema:
            type: string
            example: AVqvOB58Fg6nZfQ0ZqXt
          description: The ID of the user whose second factor credentials are listed.
      responses:
        '200':
          description: Returns an object containing an array of credentials.
          content:
            application/json:
              schema:
                type: object
                properties:
                  credentials:
                    description: Credentials
                    type: array
                    items:
                      type: object
                      properties:
                        created_at:
                          type: string
                          format: date-time
                          description: Credential timestamp.
                        phone_number:
                          type: string
                          description: The phone number used as a second factor.
                        friendly_name:
                          type: string
                          description: Credential friendly name.
                        email:
                          type: string
                          description: The email used as a second factor.
                        type:
                          type: string
                          enum:
                           - 'sms'
                           - 'email'
                          description: Second factor type.
                example:
                      {
                          "credentials": [
                              {
                                  "created_at": "2022-01-31T13:09:18.218Z",
                                  "phone_number": "++35355512344",
                                  "friendly_name": "++35355512344",
                                  "type": "sms"
                              },
                              {
                                  "created_at": "2022-01-31T13:10:17.590Z",
                                  "email": "dudette77@example.com",
                                  "friendly_name": "identifier",
                                  "type": "email"
                              }
                          ]
                      }
        '403':
          description: The MFA feature is not enabled for the user account.
        '404':
          description: The User ID does not exist.
  /api/v2/users/{user_id}/mfa/credential/sms:
    delete:
      summary: Delete MFA credentials (phone number)
      tags:
        - MFA
      security:
        - OAuth2:
          - 'manage:users'
          - 'manage:mfa'
      description: Removes the user's phone number for use as an MFA (second factor) credential.
      operationId: deleteCredentials
      parameters:
        - $ref: '#/components/parameters/Authorization'
      responses:
        '204':
          description: OK
        '400':
          description: Bad request. User has no MFA phone number credential.
      x-codeSamples:
      - lang: 'cURL'
        source: |
          curl --request DELETE \
            --url https://YOUR_DOMAIN/api/v2/users/{user_id}/mfa/credential/sms \
            --header 'Accept: application/json' \
            --header 'Authorization: Bearer eyJ0eX...ll4Q2NT' \
  /api/v2/users/{user_id}/grants:
    get:
      security:
        - OAuth2:
          - 'read:users'
      description: |
       Get user grants on all third-party clients.
        
      summary: Get user grants
      tags:
        - Grants
      operationId: getUserGrants
      parameters:
        - $ref: '#/components/parameters/Authorization'  
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  grants:
                    description: User grants
                    type: array
                    items:
                      type: object
                      properties:
                        date:
                          type: string
                          format: date-time
                          description: Grant timestamp.
                        scope:
                          type: string
                          description: List of space-delimited, case-sensitive strings representing the requested scope.
                        client_name:
                          type: string
                          description: Third-party client name.
                        client_id:
                          type: string
                          description: Third-party client ID.
                        logo:
                          type: string
                          description: Third-party client logo path.
                  scope_definitions:
                    description: Custom scope definitions
                    type: object
                    properties:
                      name:
                        description: Scope name.
                        type: string
                      translations:
                        type: array
                        description: Scope translations.
                        items:
                          type: object
                          properties:
                            lang_code:
                              type: string
                              description: Two-letter locale code in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format.
                              maxLength: 2
                              minLength: 2
                            description:
                              type: string
                              description: The localized scope description.
                            label:
                              type: string
                              description: The localized scope label.
                example:
                  {
                    "grants": [
                        {
                            "date": "2020-03-17T09:02:41.266Z",
                            "scope": "email openid phone profile",
                            "client_name": "My Third-party client",
                            "client_id": "oQPfSupG0...O487Y",
                            "logo": "filepath/logo/my_third_party_logo.png"
                        },
                        {
                            "date": "2020-03-18T15:58:05.375Z",
                            "scope": "email openid registration",
                            "client_name": "My Third-party client 2",
                            "client_id": "VLJwJJ6W...0IyFT",
                            "logo": "filepath/logo/my_third_party_2_logo.png"
                        }
                      ],
                    "scope_definitions": [
                      {
                        "translations": [
                          {
                              "lang_code": "en",
                              "description": "Read the fidelity card ID",
                              "label": "fidelity_card"
                          }
                        ],
                        "name": "fidelity_card"
                      }
                    ]
                  }
      x-codeSamples:
      - lang: 'cURL'
        source: |
          curl --request GET \ USER_ID
            --url https://YOUR_DOMAIN/api/v2/users/USER_ID/grants\
            --header 'Content-Type: application/json' \
            --header 'Authorization: Bearer eyJ0eX...ll4Q2NT' \

  /api/v2/users/{user_id}/grants/{client_id}:
    get:
      security:
        - OAuth2:
          - 'read:users'
      summary: Get user grants by client ID
      tags:
        - Grants
      description: Get user grants on a specific third-party client.
      operationId: getClientUserGrants
      parameters:
        - $ref: '#/components/parameters/Authorization'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  grants:
                    description: User grants
                    type: array
                    items:
                      type: object
                      properties:
                        date:
                          type: string
                          format: date-time
                          description: Grant timestamp.
                        scope:
                          type: string
                          description: List of space-delimited, case-sensitive strings representing the requested scope.
                        client_name:
                          type: string
                          description: Third-party client name.
                        client_id:
                          type: string
                          description: Third-party client ID.
                        logo:
                          type: string
                          description: Third-party client logo path.
                  scope_definitions:
                    description: Custom scope definitions
                    type: object
                    properties:
                      name:
                        description: Scope name
                        type: string
                      translations:
                        type: array
                        description: Scope translations.
                        items:
                          type: object
                          properties:
                            lang_code:
                              type: string
                              description: Two-letter locale code in the [ISO 639-1](https://en.wikipedia.org/wiki/ISO_639-1) format.
                              maxLength: 2
                              minLength: 2
                            description:
                              type: string
                              description: The localized scope description.
                            label:
                              type: string
                              description: The localized scope label.
                example:
                  {
                    "grants": [
                        {
                            "date": "2020-03-17T09:02:41.266Z",
                            "scope": "email openid phone profile fidelity_card",
                            "client_name": "My Third-party client",
                            "client_id": "oQPfSupG0...O487Y",
                            "logo": "filepath/logo/my_third_party_logo.png"
                        }
                      ],
                    "scope_definitions": [
                      {
                        "translations": [
                          {
                              "lang_code": "en",
                              "description": "Read the fidelity card ID",
                              "label": "fidelity_card"
                          }
                        ],
                        "name": "fidelity_card"
                      }
                    ]
                  }
      x-codeSamples:
      - lang: 'cURL'
        source: |
          curl --request GET \
            --url https://YOUR_DOMAIN/api/v2/users/USER_ID/grants/CLIENT_ID\
            --header 'Content-Type: application/json' \
            --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
    delete:
      security:
        - OAuth2:
          - 'manage:users'
      summary: Delete user grants for a client ID
      tags:
        - Grants
      description: |
        Delete user grants for a specific third-party client.
      operationId: deleteClientUserGrants
      parameters:
        - $ref: '#/components/parameters/Authorization'
      responses:
        '204':
          description: 'No content'
      x-codeSamples:
      - lang: 'cURL'
        source: |
          curl --request DELETE \
            --url https://YOUR_DOMAIN/api/v2/users/USER_ID/grants/CLIENT_ID \
            --header 'Content-Type: application/json' \
            --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'          

  /api/v2/ips/{IpAddress}:
    get:
      security:
        - OAuth2:
          - 'read:ip'
      tags:
        - IPs
      summary: Get IP status
      description: |        
        Get the status of an IP.

        > See:
        > 
        > - If the IP is currently blocked.
        > - If the IP has been blocked before.
        > - When the blockage expires for the IP.
        > 
        > **Note**: If the IP has never been blocked, no reports are listed in the reports object.

      operationId: getIpStatus
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/IpAddress'
      responses:
        '200':
          description: Returns an object showing the IP status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ipStatusObject'
        '404':
          description: IP address not found.
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v2/users/email/USER_EMAIL \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v2/users/email/{email}:
    get:
      security:
        - OAuth2:
          - 'read:users'
      tags:
        - Users
      summary: Get a user by email
      description: |        
        #### <i class="fa fa-minus-circle fa-2x" style="color: #00c24a"></i> Deprecated

        **Tip**: Use [Search users](#operation/searchUsers) to search for a user by email or [Get a user](#operation/searchUsers) if you know the user `id`.

      operationId: getUserByEmail
      deprecated: true
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/email'
      responses:
        '200':
          description: Returns the [user object](https://developer.reachfive.com/docs/models-user-profile.html#the-user-profile-object).
          content:
            application/json:
              schema:
                type: object
              example:
                email: nikkyd@email.com
                gender: female
                birthdate: '1990-10-30'
        '4XX':
          description: Returns an error if an email is not provided or found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFields'
              example:
                error_id: CgEZXXZDBT
                error_description: Email not found
                error_message_key: error.email.notFound
                error: resource_not_found
                error_user_msg: Email not found
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v2/users/email/USER_EMAIL \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v2/users/compromised:
    get:
      security:
        - OAuth2:
          - 'read:users'
      description: |
        Retrieves a list of compromised users. Compromised users are user accounts where a malicious IP was detected and the account was siloed into a separate storage location to prevent malicious activity.

        Here is an example to get you started:

        ```curl
        GET `/api/v2/users/compromised?search=test@email.com&page=1
        ```

        > **Note**: To specify a specific number of users to return, use the `count` query parameter as described below.
        >
        > If `count` is not used, a maximum of 14 users per page is returned.

      summary: Get compromised users
      tags:
        - Users
      operationId: compromisedUser
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/countCompromised'
        - in: query
          name: search
          required: false
          schema:
            type: string
          description: The part of the identifier we are looking for (**email** or **phone number**).
        - $ref: '#/components/parameters/page'
        - in: query
          name: includeUnsuspended
          required: false 
          schema:
           type: boolean
           example: true
          description: |
            Boolean query parameter where you can retrieve all user profiles that were ever compromised including those that are currently *unsuspended*.

            **Note**: If you *do not* use this query parameter, only currently compromised profiles are retrieved.
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  sub:
                    type: string
                    description: The ReachFive subscriber ID.
                    example: "AXiHc...XKOmKvdv"
                  identifier:
                    type: string
                    description: |
                      The identifier used in the search.

                      **Options**:
                      - email
                      - phone number
                    example: "uh-oh-compromised2@mail.com"
                  created_at:
                    type: string
                    format: date-time
                    description: Creation date timestamp.
                    example: "2023-05-17 09:30:06"
                  ip:
                    type: string
                    description: |
                      The attacking IP.
                      
                      In other words, the IP responsible for compromising the profile.
                    example: "01.102.103.104"
                  suspension_status:
                    type: string
                    description: The current suspension status of the compromised profile.
                    example: "temporary"
                  id:
                    type: integer
                    description: The compromised profile ID.
                    example: 2
        '403':
          description: You are not authorized to access the compromised users list.
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v2/users/compromised \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v2/users/{userId}/revoke-long-lived-tokens:
    post:
      security:
        - OAuth2:
          - 'manage:users'
      description: |
        Invalidates all sessions and tokens for a user simultaneously, forcing them to reauthenticate.
        This occurs without suspending the user.
      summary: Revoke all user sessions and tokens
      tags:
        - Users
      operationId: revokeLongLivedTokens
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
      responses:
        '200':
          description: Sessions and tokens revoked.
        '4XX':
          description: Returns an error if parameters are invalid (e.g. specifying an invalid user id).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFields'
              example:
                error_id: Ll18zIPMPK
                error_description: User not found
                error_message_key: error.user.notFound
                error: resource_not_found
                error_user_msg: User not found
  /api/v2/users/suspend:
    post:
      security:
        - OAuth2:
          - 'manage:users'
      description: |
        Suspends users, this operation blocks their login attempts and revokes previously issued tokens and sessions. 

        See also [Unsuspend](management.html#operation/unsuspendUser) to unsuspend users. 
        
      summary: Suspend users
      tags:
        - Users
      operationId: suspendUser
      parameters:
        - $ref: '#/components/parameters/Authorization'
      requestBody:
       content:
          application/json:
            schema:
              type: object
              required: 
               - ids
               - allow_password_reset
              properties:
                ids:
                  description: |
                   Lists user IDs that you want to suspend.

                   **Note**: The number of unique IDs is limited to 10,000 per request.
                  type: array
                  items:
                    type: string
                allow_password_reset:
                  description: |
                    Flag that allows (or denies) user account reactivation via a password reset. 
                    
                      * `true` allows the user account to be reactivated via password reset; sends a reset password link to users so they can unlock their account. The `suspensionStatus` field sets to `temporary`.
                      * `false` denies the user account to be reactivated via password reset; users can only be unsuspended through the [unsuspend](management.html#operation/unsuspendUser) endpoint.  The `suspensionStatus` field sets to `permanent`.
                  type: boolean
                suspension_reason:
                  description: |
                    An optional string that describes the reason why the user was suspended.

                    > **Important**: The reason must be in `camelCase`. There can be no special characters or spaces.
                    >
                    > *Example*: `"suspension_reason": "suspiciousAccountActivity"`
                    > 
                    > **Tip <i class="fa fa-lightbulb-o" aria-hidden="true"></i>**: When looking for this information on the [user profile object](https://developer.reachfive.com/docs/models-user-profile.html#the-user-profile-object), you can find it under `suspension_information.reason` like so:
                    >
                    > ```json
                    >      "suspension_information": {
                    >         "reason": "suspiciousAccountActivity"
                    >     },
                    > ```
                    >
                    > It's also good to know that if a user is suspended and they try to [log in](/openapi/identity.html#operation/loginWithPassword), they'll receive a `400 Bad Request error.account.temporarilySuspended.XXXX` response.
                  type: string
                redirect_url:
                  type: string
                  description: |
                   An optional URL that overrides the user's default password reset page (default: Emails > Templates > Account suspension > Redirect to).

                    > When using Hosted Pages, the redirect_url parameter may include an optional `returnToAfterPasswordReset` query string parameter value, if specified during signup invitation.
                    >
                    > This URL value must have been added to your identity client 'Allowed Callback URLs'.      
              example: {
                "ids": ["AW-A9V7UHw00VwEdbXNI","AW-JZ9XRtKk5eFjyRBjR","AW-LDdL8tKk5eFjyRBjb"],
                "allow_password_reset": true,
                "redirect_url":"https://client-account.reach5.net/password-reset",
                "suspension_reason": "suspiciousAccountActivity"
                      }
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  already_suspended:
                    type: array
                    description: List of IDs matching those of already suspended users.
                    items:
                      type: string
                    example: ["A1-A9V7UHw00VwEdbXjI"]
                  suspended:
                    type: array
                    description: List of IDs matching those of suspended users.
                    items:
                      type: string
                    example: ["A2-A9V7UHw00VwEdbXjI"]
                  not_found:
                    type: array
                    description: List of IDs that don't match any existing profile.
                    items:
                      type: string
                    example: ["A3-A9V7UHw00VwEdbXjI"]
                  errors:
                    type: object
                    description: List of profile IDs that couldn't be updated complete with error information.
                    properties:
                      <profile_id>:
                        $ref: '#/components/schemas/ErrorFields'
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v2/users/suspend \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data ' "ids": ["AW-A9V7UHw00VwEdbXNI","AW-JZ9XRtKk5eFjyRBjR","AW-LDdL8tKk5eFjyRBjb"],
                    "password_reset": true,"redirect_url":"https://client-account.reach5.net/password-reset"' 
  /api/v2/users/unsuspend:
    post:
      security:
        - OAuth2:
          - 'manage:users'
      description: |
        Unsuspends users; the unsuspended users are able to regain access to their account without any restrictions. This endpoint also removes the user from the compromised profiles list (if applicable).

        > **Tip**: You can "uncompromise" a user directly from the [ReachFive console](https://developer.reachfive.com/docs/ifp.html#attack-protection-bypass-header).

        > **Note:** The `suspensionStatus` flag is removed from the user's profile.

        See also [Suspend](management.html#operation/suspendUser) to suspend users.
        
      summary: Unsuspend users
      tags:
        - Users
      operationId: unsuspendUser
      parameters:
        - $ref: '#/components/parameters/Authorization'
      requestBody:
       content:
          application/json:
            schema:
              type: object
              required: 
               - ids
              properties:
                ids:
                  description: |
                   Lists user IDs that you want to unsuspend.
                   
                   **Note**: The number of unique IDs is limited to 10 000 per request.
                  type: array
                  items:
                    type: string
            example: {
                      "ids": ["AW-A9V7UHw00VwEdbXNI","AW-JZ9XRtKk5eFjyRBjR","AW-LDdL8tKk5eFjyRBjb"],
                      }     
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  not_suspended:
                    type: array
                    description: List of IDs matching those of already unsuspended users.
                    items:
                      type: string
                  unsuspended:
                    type: array
                    description: List of IDs matching those of unsuspended users.
                    items:
                      type: string
                  not_found:
                    type: array
                    description: List of IDs that doesn't match any existing profile.
                    items:
                      type: string
                  errors:
                    type: object
                    description: List of profile IDs that couldn't be updated complete with error information.
                    properties:
                      <profile_id>:
                        $ref: '#/components/schemas/ErrorFields'
              example: {
                "not_suspended": ["AW-A9V7UHw00VwEdbXNI"],
                "unsuspended": ["AW-LDdL8tKk5eFjyRBjb"],
                "not_found": ["AW-JZ9XRtKk5eFjyRBjR"],
                "errors": {
                  "234235": {
                    "error_id": "2hNBbvYecw",
                    "error_description": "Invalid email or password",
                    "error_message_key": "error.invalidEmailOrPassword",
                    "error": "invalid_grant",
                    "error_user_msg": "Invalid email or password"
                  }
                }
                       }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v2/users/unsuspend \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data ' "ids": ["AW-A9V7UHw00VwEdbXNI","AW-JZ9XRtKk5eFjyRBjR","AW-LDdL8tKk5eFjyRBjb"]'                                           
  /api/v2/users/export:
    get:
      security:
        - OAuth2:
          - 'export:users'
      summary: Export users
      tags:
        - Users
      description: |
        Search and retrieve a list of users.

        Using the [Filtering](#section/Filtering) feature of the Management API, you can filter any of the fields in the [user profile object](https://developer.reachfive.com/docs/models-user-profile.html#the-user-profile-object).

        Here is an example to get you started:

        ```curl
        GET `api/v2/users?filter=addresses.locality IN ("Marseille") AND created_at SINCE "14d"&fields=name,gender,consents
        ```

        The operation above searches for users located in Marseille that were created in the last 14 days. It also returns only the name, gender, and consents fields.
        
      operationId: exportUsers
      parameters:
        - in: query
          name: format
          required: true
          schema:
            type: string
            enum:
              - csv
              - json
        - $ref: '#/components/parameters/fields'
        - $ref: '#/components/parameters/filter'
      responses:
        '200':
          description: Returns matching users
          content:
            application/json:
              example:
                  {
                    "id":"AVs03HoxJSTFLRxVXhri",
                    "name":"John Doe",
                    "email":"johndoe@example.com"
                  }
            text/csv:
              example: |
                id,name,email
                AVs03HoxJSTFLRxVXhri,John Doe,johndoe@example.com
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v2/users/export?format=FORMAT&fields=id,name,email&filter=gender%20%3D%3D%20%22male%22 \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v2/users/{user_id1}/merge/{user_id2}:
    post:
      security:
        - OAuth2:
          - 'manage:users'
      tags:
        - Users
      summary: Merge users
      description: |
        Merge two user profiles. If verified, the `email` and `phone_number` identifiers are always kept in the unified profile. If both identifiers are verified, the most recent is kept in the unified profile.

        **Note:**  If one of the merged profiles contains an empty attribute, that attribute is updated with the value from the other profile.

        **Note**:  If an attribute is present in *both* merged profiles, the unified profile will take the most recent value (based on the `updated_at` attribute).

        **Consents**: If a consent is present in *both* merged profiles, the unified profile will take the most recent value (based on the consent's `date` attribute).

      operationId: mergeUsers
      parameters:
        - in: path
          name: user_id1
          required: true
          schema:
            type: string
            example: AVqvOB58Fg6nZfQ0ZqXt
          description: ID of the user to update. This ID is kept in the new user profile.
        - in: path
          name: user_id2
          required: true
          schema:
            type: string
            example: AVs03HoxJSTFLRxVXhri
          description: ID of the user to merge.
        - $ref: '#/components/parameters/fields'
        - $ref: '#/components/parameters/Authorization'
      responses:
        '200':
          description: Return the user profile resulting from the merge if the call succeeded.
          content:
            application/json:
              schema:
                type: object
              example:
                id: AVs03HoxJSTFLRxVXhri
                given_name: John
                family_name: Doe
                email: johndoe@example.com
                birthdate: '1981-10-13'
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v2/users/USER_ID1/merge/USER_ID2?fields?id,given_name,family_name,email,birthdate \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v2/users/{user_id}/identities/{identity_unique_id}:
    delete:
      security:
        - OAuth2:
          - 'manage:users'
      tags:
        - Users
      summary: Remove a user identity
      description: |
        Removes a user identity. If successful, the endpoint returns the user profile with the identity removed.
      operationId: removeUserIdentity
      parameters:
        - in: path
          name: user_id
          required: true
          schema:
            type: string
            example: AVqvOB58Fg6nZfQ0ZqXt
          description: ID of the user.
        - in: path
          name: identity_unique_id
          required: true
          schema:
            type: string
            example: facebook:121146661725694 # https://github.com/Redocly/redoc/issues/1010
          description: |
            Unique id of the identity to remove. This is often a social login profile identity.

            > **Note**: To retrieve this unique ID, use the [Get a User](management.html#operation/getUser) endpoint which returns the [user object](https://developer.reachfive.com/docs/models-user-profile.html#the-user-profile-object) where this id is found under the [identities object](https://developer.reachfive.com/docs/models-user-profile.html#identities-object) as `id`.
            >
            > *PayPal*: PayPal identities are, in fact, URLs. To ensure that ReachFive recognizes this as an identity and not a continuation of the URL itself, here are a few tips:
            > 
            > - Encode any character that is not alphanumeric in the URL. See [here](https://www.w3schools.com/tags/ref_urlencode.ASP) for more details on encoding characters.
            > - Typically, these are colons `:` (encode with `%3A`) and slashes `/` (encode with `%2F`) in URLs.
            >
            > An example: `https://{{domain}}/api/v2/users/{user_id}/identities/paypal:https%3A%2F%2Fwww.paypal.com%2Fwebapps%2Fauth%2Fidentity%2Fuser%2FdcCyyW98_QkNq...xQlUWEYAY1Sc`.
        - $ref: '#/components/parameters/keepInLiteProfile'
        - $ref: '#/components/parameters/fields'
        - $ref: '#/components/parameters/Authorization'
      responses:
        '204':
          description: User identity was removed.
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request DELETE \
              --url https://YOUR_DOMAIN/api/v2/users/USER_ID/identities/IDENTITY_UNIQUE_ID \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v2/users/{user_id}/providers/{provider}:
    delete:
      security:
        - OAuth2:
          - 'manage:users'
      tags:
        - Users
      summary: Remove a user provider
      description: |
        Remove all user identities coming from the specified provider.

        On success, the endpoint returns the new user profile.
      operationId: removeUserProvider
      parameters:
        - in: path
          name: user_id
          required: true
          schema:
            type: string
            example: AVqvOB58Fg6nZfQ0ZqXt
          description: ID of the user.
        - in: path
          name: provider
          required: true
          schema:
            type: string
            example: facebook
          description: Name of the provider for which users identity should be removed. See provider field of Identity object. # not available?
        - $ref: '#/components/parameters/keepInLiteProfile'
        - $ref: '#/components/parameters/Authorization'
      responses:
        '204':
          description: User identities for specified provider are removed
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request DELETE \
              --url https://YOUR_DOMAIN/api/v2/users/USER_ID/providers/PROVIDER \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v2/users/{user_id}/send-phone-number-verification:
    post:
      security:
        - OAuth2:
          - 'manage:users'
      tags:
        - Users
      summary: Send a verification SMS
      description: |
        Sends an SMS with a verification code so the user can verify the supplied phone number.
      operationId: sendVerificationSMS
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
      responses:
        '200':
          description: Verification code sent successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/requestSmsVerificationResponse'
  /api/v2/users/{user_id}/verify-phone-number:
    post:
      security:
        - OAuth2:
          - 'manage:users'
      tags:
        - Users
      summary: Verify user phone number
      description: |
        Send the `verification_code` received from the verification request to confirm the user's phone number.
      operationId: verifyPhoneNumberViaSms
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/smsVerificationRequest'
      responses:
        '200':
          description: Verification code accepted; phone number verified.
  /api/v2/users/{user_id}/verify-email:
    post:
      security:
        - OAuth2:
          - 'manage:users'
      tags:
        - Users
      summary: Send a verification email
      description: |
        Sends an email asking the user to click a link to verify the supplied email address.
      operationId: sendVerificationEmail
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                redirect_url:
                  type: string
                  description: |
                    An optional URL to override the page users are sent to, once their email is verified (default: Emails > Templates > Verify email > Redirect to).

                    > If the user is redirected to the "Email confirmation" [Hosted Page](https://developer.reachfive.com/docs/hosted-pages.html), the `redirect_url` parameter may include an optional `return_to_after_email_validation` query string parameter value.
                    > 
                    > This `return_to_after_email_validation` parameter represents the destination URL of the "Go home" link on the Email confirmation Hosted page.
                    > 
                    > The URL value must be in your client's **Allowed Callback URLs**.
            examples:
              Standard:
                value:
                  {
                    "redirect_url":"https://client-account.reach5.net/email-confirmation"
                  }
              With custom redirect parameter (Hosted Pages):
                value:
                  {
                    "redirect_url":"https://client-account.reach5.net/email-confirmation?return_to_after_email_confirmation=https://reachfive.com/fr"
                  }
      responses:
       '204':
         description: The verification email is sent
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v2/users/USER_ID/verify-email \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                "redirect_url": "https://YOUR_DOMAIN/email-confirmation"
              }'
  /api/v2/users/{user_id}/consent-log:
    get:
      security:
        - OAuth2:
          - 'read:users'
      tags:
        - Users
      summary: List user consent logs
      description: List consent log for a specific user.
      operationId: getUserConsentLogs
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
        - $ref: '#/components/parameters/filter'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/count'
        - $ref: '#/components/parameters/sort'
      responses:
        '200':
          description: The list of consents given by the user
          content:
            application/json:
              schema:
                type: object
                properties:
                  date:
                    type: string
                    format: date-time
                    description: 'Timestamp of the operation'
                    example: 2019-06-08T14:00:00.000123Z
                  user_id:
                    type: string
                    pattern: '[a-zA-Z0-9-_]{20}'
                    description: ReachFive user ID
                    example: AWuJkHOg0cMwBBjww0_4
                  ip_address:
                    type: string
                    format: ipv4
                    description: The machine's IP address
                    example: 172.18.0.2
                  consent_title:
                    type: string
                    description: The title of the consent.
                    example: all-the-consents
                  consent_version:
                    type: integer
                    description: The version of the consent.
                    example: 1
                  source:
                    type: object
                    description: Specifies the information about where and who modified the consent.
                    properties:
                      canal:
                        type: string
                        description: |
                          The channel through which the consent was modified.

                          **Note**: This is either the Identity API, Management API, ReachFive Console, or a scheduled job.
                        example: management-api
                      id:
                        type: string
                        description: |
                          The ID of source.

                          - For jobs, this is the specific job ID (not the job definition ID).
                          - For Management clients, this is the Management Client ID.
                          - For Identity clients, this is the Identity Client ID.
                        example: AWuJkHOg0cMwBBjww0_4
                      name:
                        type: string
                        description: |
                          The name of the source.

                          **Note**: This is the friendly name given to the job or client.
                        example: Management Client
                      user:
                        type: object
                        description: |
                          The reporter information. In other words, the user who made the consent modification. This is
                          used when the source is the ReachFive Console.

                          **Note**: The reporter information there is not available when the source is the Management API or 
                          a scheduled job.

                          **Note**: When the source is the Identity API, the reporter information is taking from the `user_id` field.
                        properties:
                          email:
                            type: string
                            description: The email of the user making the consent modification.
                            example: yo@example.com
                          id:
                            type: string
                            description: The ID of the user making the consent modification.
                            example: AWuJkHOMwBBjww0_4
                  consent_key:
                    type: string
                    description: The unique consent identifier in `snake_case`.
                    pattern: '[a-z][a-z0-9]*(_[a-z][a-z0-9]*)*'
                    example: billeterie
                  granted:
                    type: boolean
                    description: Whether users have granted consent
                    example: true
                  consent_type:
                    type: string
                    description: The consent type.
                    example: opt-in
                    enum:
                    - opt-in
                    - opt-out
              examples:
                Get Consent Logs:
                  value:
                        {
                        "consent_key": "all-the-things",
                        "consent_title": "all the things",
                        "consent_type": "opt-out",
                        "consent_version": {
                          "language": "fr",
                          "version_id": 1
                        },
                        "date": "2021-10-25T13:34:54.000Z",
                        "granted": false,
                        "id": "AXy3qUft...AqIjInslG",
                        "is_group": false,
                        "source": {
                          "canal": "job",
                          "id": "AXy3q...qIjInslF",
                          "name": "update user consents"
                        },
                        "user_id": "AXy3qR..IjInsk9"
                      }
                Get Consent Logs with Console:
                  value:
                      {
                        "consent_key": "all-the-things-console",
                        "consent_title": "all-the-things-console",
                        "consent_type": "opt-out",
                        "consent_version": {
                          "language": "fr",
                          "version_id": 1
                        },
                        "date": "2021-10-25T13:36:18.292Z",
                        "granted": true,
                        "host": "https://console.reach5.co",
                        "is_group": false,
                        "source": {
                          "canal": "console",
                          "user": {
                            "email": "user@example.com",
                            "id": "AXy24_q..AqIjInsk2"
                          }
                        },
                        "user_id": "AXy3q...qIjInsk9"
                      }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v2/users/USER_ID/consent-log \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v1/user-consents/:key/grant-stats:
    get:
      security:
        - OAuth2:
          - 'read:consents'
      summary: Get consent grant stats
      tags:
        - Consents
      description: Get count of granted, refused, and missing consents.
      operationId: getConsentGrantStats
      parameters:
        - $ref: '#/components/parameters/key'
      responses:
        '200':
          description: 'OK'
          content:
            application/json:
              schema:
                type: object
                properties:
                  total:
                    type: integer
                    description: Total number of users
                  consents:
                    type: object
                    properties:
                      total:
                        type: integer
                        description: Total number of users
                      values:
                        type: array
                        description: The split count of granted/refused/missing user consent
                        maxItems: 3
                        items:
                          $ref: '#/components/schemas/UserConsentType'
                      title:
                        type: string
                        description: Consent title
                example: {
                  "total": 91345,
                  "consents": {
                      "total": 91345,
                      "values": [
                          {
                              "count": 42215,
                              "key": "refused"
                          },
                          {
                              "count": 41782,
                              "key": "granted"
                          },
                          {
                              "count": 7348,
                              "key": "missing"
                          },
                      ],
                      "title": "billeterie"
                  }
                }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v1/user-consents/KEY/grant-stats \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /oauth/introspect:
    post:
      security:
        - OAuth2:
          - 'none'
      summary: Introspect a token
      tags:
        - OAuth
      description: |
        This endpoint returns the content of an access, or refresh token.

        The client must belong to the same account as the token.

        To decode tokens, read [this page](../docs/decode-tokens.html).

        See [RFC 7662](https://tools.ietf.org/html/rfc7662) for more details.
      operationId: introspectToken
      requestBody:
        content:
          application/x-www-form-urlencoded:
            schema:
              type: object
              properties:
                client_id:
                  type: string
                  description: ReachFive client ID
                client_secret:
                  type: string
                  description: ReachFive client secret
                token:
                  type: string
                  description: The Access Token to introspect
              required:
                - client_id
                - client_secret
                - token
      responses:
        '200':
          description: Return properties of the token
          content:
            application/json:
              schema:
                type: object
              examples:
                Access token:
                  value:
                    {
                      "sub": "d4F0qGFMYAwTAGi58lU9",
                      "aud": [
                          "https://client-account.reach5.net/api"
                      ],
                      "scope": "export:users manage:clients manage:consents manage:users read:clients read:consents read:users",
                      "iss": "https://client-account.reach5.net",
                      "active": true,
                      "token_type": "access_token",
                      "exp": 1582303149,
                      "iat": 1582299649,
                      "client_id": "d4F0qGFMYAwTAGi58lU9"
                    }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/oauth/introspect \
              --header 'Content-type: application/json'
              --data '{
                  "client_id": "CLIENT_ID",
                  "client_secret": "CLIENT_SECRET",
                  "token": "TOKEN"
                }'
  /api/v1/profile/schema:
    post:
      security:
        - OAuth2:
            - "manage:custom-fields-schema"
      tags:
        - Profile custom field schemas
      summary: Create profile custom field schema
      description: |
        Create a new custom field schema for user profiles.

        **Note**: Creating a custom field schema does not associate the custom field to any particular user. To do this, you should use the [Manage Users operations](#tag/Users).

      operationId: createCustomFieldSchemaProfile
      parameters:
        - $ref: "#/components/parameters/Authorization"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/customFields"
      responses:
        "200":
          description: Successfully created the new custom field schema. You can see the new custom field available to users on your [ReachFive Console](https://developer.reachfive.com/docs/custom-fields.html).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/customFields"
      x-codeSamples:
        - lang: "cURL"
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v1/profile/schema \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data-raw '{
                  "grant_type": "client_credentials",
                  "client_id": CLIENT_ID,
                  "client_secret": CLIENT_SECRET,
                  "scope": "manage:custom-fields-schema,read:custom-fields-schema"
                }'
    get:
      security:
        - OAuth2:
            - "read:custom-fields-schema"
      tags:
        - Profile custom field schemas
      summary: Get profile custom fields
      description: |
        Retrieves all profile custom fields associated with the account.

      operationId: getCustomFieldsProfile
      parameters:
        - $ref: "#/components/parameters/Authorization"
      responses:
        "200":
          description: Successfully retrieved the custom fields. If there are multiple custom fields, it returns an array of custom field objects.
          content:
            application/json:
              schema:
                type: array
                description: Returns an array of custom field objects.
                items:
                  $ref: "#/components/schemas/customFields"
      x-codeSamples:
        - lang: "cURL"
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v1/profile/schema \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v1/profile/schema/<custom_field>:
    get:
      security:
        - OAuth2:
            - "read:custom-fields-schema"
      tags:
        - Profile custom field schemas
      summary: Get profile custom field schema
      description: Retrieve schema for a specific profile custom field.
      operationId: getCustomFieldSchemaProfile
      parameters:
        - $ref: "#/components/parameters/Authorization"
        - $ref: "#/components/parameters/customField"
      responses:
        "200":
          description: Success. Returns the custom field schema.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/customFields"
      x-codeSamples:
        - lang: "cURL"
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v1/profile/schema/custom_field \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data-raw '{
                  "grant_type": "client_credentials",
                  "client_id": CLIENT_ID,
                  "client_secret": CLIENT_SECRET,
                  "scope": "read:custom-fields-schema"
                }'
    put:
      security:
        - OAuth2:
            - "manage:custom-fields-schema"
      tags:
        - Profile custom field schemas
      summary: Update profile custom field schema
      description: |
        Update an existing profile custom field schema.

        **Note**: While you can change the `name` and `scope`. You *cannot* alter the `data_type` or `path` of the schema

        **Note**: Update a custom field schema does not associate the custom field to any particular user. To do this, you should use the [Manage Users operations](#tag/Users).
      operationId: updateCustomFieldSchemaProfile
      parameters:
        - $ref: "#/components/parameters/Authorization"
        - $ref: "#/components/parameters/customField"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/customFields"
      responses:
        "200":
          description: Successfully updated the custom field schema.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/customFields"
      x-codeSamples:
        - lang: "cURL"
          source: |
            curl --request PUT \
              --url https://YOUR_DOMAIN/api/v1/profile/schema/custom_field \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data-raw '{
                  "grant_type": "client_credentials",
                  "client_id": CLIENT_ID,
                  "client_secret": CLIENT_SECRET,
                  "scope": "manage:custom-fields-schema,read:custom-fields-schema"
                }'
    delete:
      security:
        - OAuth2:
            - "manage:custom-fields-schema"
      tags:
        - Profile custom field schemas
      summary: Delete profile custom field schema
      description: Remove an existing profile custom field schema.
      operationId: deleteCustomFieldSchemaProfile
      parameters:
        - $ref: "#/components/parameters/Authorization"
        - $ref: "#/components/parameters/customField"
      responses:
        "204":
          description: Successfully deleted the custom field schema.
      x-codeSamples:
        - lang: "cURL"
          source: |
            curl --request DELETE \
              --url https://YOUR_DOMAIN/api/v1/profile/schema/custom_field \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data-raw '{
                  "grant_type": "client_credentials",
                  "client_id": CLIENT_ID,
                  "client_secret": CLIENT_SECRET,
                  "scope": "manage:custom-fields-schema,read:custom-fields-schema"
                }'
  /api/v1/address/schema:
    post:
      security:
        - OAuth2:
            - "manage:custom-fields-schema"
      tags:
        - Address custom field schemas
      summary: Create address custom field schema
      description: |
        Create a new custom field schema for addresses.

        **Note**: Creating a custom field schema does not associate the custom field to any particular user. To do this, you should use the [Manage Users operations](#tag/Users).

      operationId: createCustomFieldSchemaAddress
      parameters:
        - $ref: "#/components/parameters/Authorization"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/customFields"
      responses:
        "200":
          description: Successfully created the new custom field schema. You can see the new custom field available to users on your [ReachFive Console](https://developer.reachfive.com/docs/custom-fields.html).
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/customFields"
      x-codeSamples:
        - lang: "cURL"
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v1/address/schema \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data-raw '{
                  "grant_type": "client_credentials",
                  "client_id": CLIENT_ID,
                  "client_secret": CLIENT_SECRET,
                  "scope": "manage:custom-fields-schema,read:custom-fields-schema"
                }'
    get:
      security:
        - OAuth2:
            - "read:custom-fields-schema"
      tags:
        - Address custom field schemas
      summary: Get all address custom fields
      description: |
        Retrieves all address custom fields associated with the account.

      operationId: getCustomFieldsAddress
      parameters:
        - $ref: "#/components/parameters/Authorization"
      responses:
        "200":
          description: Successfully retrieved the custom fields. If there are multiple custom fields, it returns an array of custom field objects.
          content:
            application/json:
              schema:
                type: array
                description: Returns an array of custom field objects.
                items:
                  $ref: "#/components/schemas/customFields"
      x-codeSamples:
        - lang: "cURL"
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v1/address/schema \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v1/address/schema/<custom_field>:
    get:
      security:
        - OAuth2:
            - "read:custom-fields-schema"
      tags:
        - Address custom field schemas
      summary: Get address custom field schema
      description: Retrieve schema for a specific address custom field.
      operationId: getCustomFieldSchemaAddress
      parameters:
        - $ref: "#/components/parameters/Authorization"
        - $ref: "#/components/parameters/customField"
      responses:
        "200":
          description: Success. Returns the custom field schema.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/customFields"
      x-codeSamples:
        - lang: "cURL"
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v1/address/schema/custom_field \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data-raw '{
                  "grant_type": "client_credentials",
                  "client_id": CLIENT_ID,
                  "client_secret": CLIENT_SECRET,
                  "scope": "read:custom-fields-schema"
                }'
    put:
      security:
        - OAuth2:
            - "manage:custom-fields-schema"
      tags:
        - Address custom field schemas
      summary: Update address custom field schema
      description: |
        Update an existing address custom field schema.

        **Note**: While you can change the `name` and `scope`. You *cannot* alter the `data_type` or `path` of the schema

        **Note**: Update a custom field schema does not associate the custom field to any particular user. To do this, you should use the [Manage Users operations](#tag/Users).
      operationId: updateCustomFieldSchemaAddress
      parameters:
        - $ref: "#/components/parameters/Authorization"
        - $ref: "#/components/parameters/customField"
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/customFields"
      responses:
        "200":
          description: Successfully updated the custom field schema.
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/customFields"
      x-codeSamples:
        - lang: "cURL"
          source: |
            curl --request PUT \
              --url https://YOUR_DOMAIN/api/v1/address/schema/custom_field \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data-raw '{
                  "grant_type": "client_credentials",
                  "client_id": CLIENT_ID,
                  "client_secret": CLIENT_SECRET,
                  "scope": "manage:custom-fields-schema,read:custom-fields-schema"
                }'
    delete:
      security:
        - OAuth2:
            - "manage:custom-fields-schema"
      tags:
        - Address custom field schemas
      summary: Delete address custom field schema
      description: Remove an existing address custom field schema.
      operationId: deleteCustomFieldSchemaAddress
      parameters:
        - $ref: "#/components/parameters/Authorization"
        - $ref: "#/components/parameters/customField"
      responses:
        "204":
          description: Successfully deleted the custom field schema.
      x-codeSamples:
        - lang: "cURL"
          source: |
            curl --request DELETE \
              --url https://YOUR_DOMAIN/api/v1/address/schema/custom_field \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data-raw '{
                  "grant_type": "client_credentials",
                  "client_id": CLIENT_ID,
                  "client_secret": CLIENT_SECRET,
                  "scope": "manage:custom-fields-schema,read:custom-fields-schema"
                }'

  /api/v1/ds/schema:
    post:
      security:
        - OAuth2:
          - 'manage:custom-fields-schema'
      tags:
        - Custom Field Schemas
      summary: Create custom field schema
      description: |
        Create a new custom field schema.

        **Note**: Creating a custom field schema does not associate the custom field to any particular user. To do this, you should use the [Manage Users operations](#tag/Users).
        
      operationId: createCustomFieldSchema
      deprecated: true
      parameters:
        - $ref: '#/components/parameters/Authorization'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/customFields'
      responses:
        '200':
          description: Successfully created the new custom field schema. You can see the new custom field available to users on your [ReachFive Console](https://developer.reachfive.com/docs/custom-fields.html).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/customFields'
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v1/ds/schema \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data-raw '{
                  "grant_type": "client_credentials",
                  "client_id": CLIENT_ID,
                  "client_secret": CLIENT_SECRET,
                  "scope": "manage:custom-fields-schema,read:custom-fields-schema"
                }'
    get:
      security:
        - OAuth2:
          - 'read:custom-fields-schema'
      tags:
        - Custom Field Schemas
      summary: Get all custom fields
      description: |
        Retrieves all custom fields associated with the account.
        
      operationId: getCustomFields
      deprecated: true
      parameters:
        - $ref: '#/components/parameters/Authorization'
      responses:
        '200':
          description: Successfully retrieved the custom fields. If there are multiple custom fields, it returns an array of custom field objects.
          content:
            application/json:
              schema:
                type: array
                description: Returns an array of custom field objects.
                items:
                  $ref: '#/components/schemas/customFields'
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v1/ds/schema \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v1/ds/schema/<custom_field>:
    get:
      security:
        - OAuth2:
          - 'read:custom-fields-schema'
      tags:
        - Custom Field Schemas
      summary: Get custom field schema
      description: Retrieve schema for a specific custom field.
      operationId: getCustomFieldSchema
      deprecated: true
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/customField'
      responses:
        '200':
          description: Success. Returns the custom field schema.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/customFields'
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v1/ds/schema/custom_field \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data-raw '{
                  "grant_type": "client_credentials",
                  "client_id": CLIENT_ID,
                  "client_secret": CLIENT_SECRET,
                  "scope": "read:custom-fields-schema"
                }'
    put:
      security:
        - OAuth2:
          - 'manage:custom-fields-schema'
      tags:
        - Custom Field Schemas
      summary: Update custom field
      description: |
        Update an existing custom field schema.

        **Note**: While you can change the `name` and `scope`. You *cannot* alter the `data_type` or `path` of the schema

        **Note**: Update a custom field schema does not associate the custom field to any particular user. To do this, you should use the [Manage Users operations](#tag/Users).
      operationId: updateCustomFieldSchema
      deprecated: true
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/customField'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/customFields'
      responses:
        '200':
          description: Successfully updated the custom field schema.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/customFields'
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request PUT \
              --url https://YOUR_DOMAIN/api/v1/ds/schema/custom_field \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data-raw '{
                  "grant_type": "client_credentials",
                  "client_id": CLIENT_ID,
                  "client_secret": CLIENT_SECRET,
                  "scope": "manage:custom-fields-schema,read:custom-fields-schema"
                }'
    delete:
      security:
        - OAuth2:
          - 'manage:custom-fields-schema'
      tags:
        - Custom Field Schemas
      summary: Delete custom field schema
      description: Remove an existing custom field schema.
      operationId: deleteCustomFieldSchema
      deprecated: true
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/customField'
      responses:
        '204':
          description: Successfully deleted the custom field schema.
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request DELETE \
              --url https://YOUR_DOMAIN/api/v1/ds/schema/custom_field \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data-raw '{
                  "grant_type": "client_credentials",
                  "client_id": CLIENT_ID,
                  "client_secret": CLIENT_SECRET,
                  "scope": "manage:custom-fields-schema,read:custom-fields-schema"
                }'
  /api/v2/users/{userId}/addresses/{addressId}:
    get:
      security:
        - OAuth2:
          - 'read:users'
      tags:
        - Addresses
      summary: Get a user address
      description: Get the address of a user by ID.
      operationId: getUserAddressByID
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
        - $ref: '#/components/parameters/addressId'
      responses:
        '200':
          description: Return the specified user address.
          content:
            application/json:
              schema:
                type: object
                properties:
                  country:
                    type: string
                    description: Country
                  street_address:
                    type: string
                    description: Street address
                  default:
                    type: boolean
                    description: Returned only when the address is the default (`true`)
                  locality:
                    type: string
                    description: Locality
                  id:
                    type: integer
                    description: Address ID
                  postal_code:
                    type: string
                    description: Postal code
                  region:
                    type: string
                    description: Region
                  title:
                    type: string
                    description: Free label
              example: {
                "country": "France",
                "street_address": "33 rue La Fayette",
                "locality": "Paris",
                "id": 1,
                "postal_code": "75009",
                "region": "Ile-de-France",
                "title": "Work"
              }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v2/users/USER_ID/addresses/ADDRESS_ID \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v2/users/{userId}/addresses:
    get:
      security:
        - OAuth2:
          - 'read:users'
      tags:
        - Addresses
      summary: Get user addresses
      description: Get a user's addresses.
      operationId: getUserAddresses
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
      responses:
        '200':
          description: Return an array of addresses
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    country:
                      type: string
                      description: Country
                    street_address:
                      type: string
                      description: Street address
                    default:
                      type: boolean
                      description: Returned only when the address is the default (`true`)
                    locality:
                      type: string
                      description: Locality
                    id:
                      type: integer
                      description: Address ID
                    postal_code:
                      type: string
                      description: Postal code
                    region:
                      type: string
                      description: Region
                    title:
                      type: string
                      description: Free label
              example: [
                {
                    "country": "France",
                    "street_address": "40 Rue d'Astorg",
                    "default": true,
                    "locality": "Paris",
                    "id": 0,
                    "postal_code": "75008",
                    "region": "Ile-de-France",
                    "title": "Principal"
                },
                {
                    "country": "France",
                    "street_address": "33 rue La Fayette",
                    "locality": "Paris",
                    "id": 1,
                    "postal_code": "75009",
                    "region": "Ile-de-France",
                    "title": "Work"
                }
              ]
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v2/users/USER_ID/addresses \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v2/managed-users/{userId}/addresses:
    post:
      security:
        - OAuth2:
            - 'manage:users'
      tags:
        - Addresses
      summary: Create a new user address
      description: Create a new user's address.
      operationId: createUserAddress
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Address'
            example: {
              "country": "France",
              "street_address": "40 Rue d'Astorg",
              "default": true,
              "locality": "Paris",
              "title": "Principal",
              "postal_code": "75008",
              "region": "Ile-de-France"
            }
      responses:
        '200':
          description: Return the created address with its ID
          content:
            application/json:
              schema:
                type: object
                properties:
                  country:
                    type: string
                    description: Country
                  street_address:
                    type: string
                    description: Street address
                  default:
                    type: boolean
                    description: Returned only when the address is the default (`true`)
                  locality:
                    type: string
                    description: Locality
                  id:
                    type: integer
                    description: Address ID
                  postal_code:
                    type: string
                    description: Postal code
                  region:
                    type: string
                    description: Region
                  title:
                    type: string
                    description: Free label
              example: {
                "country": "France",
                "street_address": "40 Rue d'Astorg",
                "default": true,
                "locality": "Paris",
                "id": 0,
                "postal_code": "75008",
                "region": "Ile-de-France",
                "title": "Principal"
              }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v2/managed-users/USER_ID/addresses \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                "country": "France",
                "street_address": "40 Rue d'Astorg",
                "default": true,
                "locality": "Paris",
                "title": "Principal",
                "postal_code": "75008",
                "region": "Ile-de-France"
              }'
    put:
      security:
        - OAuth2:
            - 'manage:users'
      tags:
        - Addresses
      summary: Update user addresses
      description: 'Overwrite all addresses of the specified user.'
      operationId: updateUserAddresses
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
      requestBody:
        description: ''
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/Address'
              example: [
                {
                    "country": "United Kingdom",
                    "street_address": "39 London Rd",
                    "default": true,
                    "locality": "Southwark",
                    "postal_code": "SE1 6JW",
                    "region": "London",
                    "title": "Billing address"
                },
                {
                    "country": "France",
                    "street_address": "40 rue d'Astorg",
                    "locality": "Paris",
                    "postal_code": "75008",
                    "region": "Ile-de-France",
                    "title": "Principal"
                }
              ]
      responses:
        '200':
          description: Return the array of addresses as passed
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    country:
                      type: string
                      description: Country
                    street_address:
                      type: string
                      description: Street address
                    default:
                      type: boolean
                      description: Returned only when the address is the default (`true`)
                    locality:
                      type: string
                      description: Locality
                    id:
                      type: integer
                      description: Address ID
                    postal_code:
                      type: string
                      description: Postal code
                    region:
                      type: string
                      description: Region
                    title:
                      type: string
                      description: Free label
              example: [
                {
                    "country": "United Kingdom",
                    "street_address": "39 London Rd",
                    "default": true,
                    "locality": "Southwark",
                    "id": 0,
                    "postal_code": "SE1 6JW",
                    "region": "London",
                    "title": "Billing address"
                },
                {
                    "country": "France",
                    "street_address": "40 rue d'Astorg",
                    "locality": "Paris",
                    "id": 1,
                    "postal_code": "75008",
                    "region": "Ile-de-France",
                    "title": "Principal"
                }
              ]
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request PUT \
              --url https://YOUR_DOMAIN/api/v2/managed-users/USER_ID/addresses \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                "country": "France",
                "street_address": "40 Rue d'Astorg",
                "default": true,
                "locality": "Paris",
                "title": "Principal",
                "postal_code": "75008",
                "region": "Ile-de-France"
              }'
    delete:
      security:
        - OAuth2:
            - 'manage:users'
      tags:
        - Addresses
      summary: Delete user addresses
      description: 'Delete all the addresses of a user.'
      operationId: deleteUserAddresses
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
      responses:
        '204':
          description: All user addresses have been deleted successfully
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request DELETE \
              --url https://YOUR_DOMAIN/api/v2/managed-users/USER_ID/addresses \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v2/managed-users/{user_id}/addresses/{address_id}:
    post:
      security:
        - OAuth2:
          - 'manage:users'
      tags:
        - Addresses
      summary: Update a user address
      description: 'Update a specific address of a user.'
      operationId: updateUserAddress
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
        - $ref: '#/components/parameters/addressId'
      requestBody:
        description: ''
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Address'
            example: {
              "country": "France",
              "street_address": "255 Boulevard Pereire Ground",
              "locality": "Paris",
              "postal_code": "75017",
              "region": "Ile-de-France",
              "title": "Work"
            }
      responses:
        '200':
          description: Return the updated address with its ID
          content:
            application/json:
              schema:
                type: object
                properties:
                  country:
                    type: string
                    description: Country
                  street_address:
                    type: string
                    description: Street address
                  default:
                    type: boolean
                    description: Returned only when the address is the default (`true`)
                  locality:
                    type: string
                    description: Locality
                  id:
                    type: integer
                    description: Address ID
                  postal_code:
                    type: string
                    description: Postal code
                  region:
                    type: string
                    description: Region
                  title:
                    type: string
                    description: Free label
              example: {
                "country": "France",
                "street_address": "255 Boulevard Pereire Ground",
                "locality": "Paris",
                "id": 1,
                "postal_code": "75017",
                "region": "Ile-de-France",
                "title": "Work"
              }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v2/managed-users/USER_ID/addresses/ADDRESS_ID \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                "country": "France",
                "street_address": "40 Rue d'Astorg",
                "default": true,
                "locality": "Paris",
                "title": "Principal",
                "postal_code": "75008",
                "region": "Ile-de-France"
              }'
    delete:
      security:
        - OAuth2:
          - 'manage:users'
      tags:
        - Addresses
      summary: Delete a user address
      description: ''
      operationId: deleteUserAddress
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
        - $ref: '#/components/parameters/addressId'
      responses:
        '204':
          description: The address is deleted successfully
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request DELETE \
              --url https://YOUR_DOMAIN/api/v2/managed-users/USER_ID/addresses/ADDRESS_ID \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v2/lite-users/{userId}/addresses:
    post:
      security:
        - OAuth2:
          - 'manage:users'
      tags:
        - Addresses
      summary: Create a new user address (LITE)
      description: ''
      operationId: createLiteUserAddress
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
      requestBody:
        description: ''
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Address'
            example: {
              "country": "France",
              "street_address": "40 Rue d'Astorg",
              "default": true,
              "locality": "Paris",
              "title": "Principal",
              "postal_code": "75008",
              "region": "Ile-de-France"
            }
      responses:
        '200':
          description: Return the created address with its ID
          content:
            application/json:
              schema:
                type: object
                properties:
                  country:
                    type: string
                    description: Country
                  street_address:
                    type: string
                    description: Street address
                  default:
                    type: boolean
                    description: Returned only when the address is the default (`true`)
                  locality:
                    type: string
                    description: Locality
                  id:
                    type: integer
                    description: Address ID
                  postal_code:
                    type: string
                    description: Postal code
                  region:
                    type: string
                    description: Region
                  title:
                    type: string
                    description: Free label
              example: {
                "country": "France",
                "street_address": "40 Rue d'Astorg",
                "default": true,
                "locality": "Paris",
                "id": 0,
                "postal_code": "75008",
                "region": "Ile-de-France",
                "title": "Principal"
              }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v2/managed-users/USER_ID/addresses/ADDRESS_ID \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                "country": "France",
                "street_address": "255 Boulevard Pereire Ground",
                "locality": "Paris",
                "postal_code": "75017",
                "region": "Ile-de-France",
                "title": "Work"
              }'
    put:
      security:
        - OAuth2:
          - 'manage:users'
      tags:
        - Addresses
      summary: Update user addresses (LITE)
      description: 'Overwrite all addresses of the specified user.'
      operationId: updateLiteUserAddresses
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
      requestBody:
        description: ''
        required: true
        content:
          application/json:
            schema:
              type: array
              items:
                type: object
                properties:
                  country:
                    type: string
                    description: Country
                  street_address:
                    type: string
                    description: Street address
                  locality:
                    type: string
                    description: Locality
                  postalCode:
                    type: string
                    description: Postal code
                  region:
                    type: string
                    description: Region
                  title:
                    type: string
                    description: Free label
              example: [
                {
                    "country": "United Kingdom",
                    "street_address": "39 London Rd",
                    "default": true,
                    "locality": "Southwark",
                    "postal_code": "SE1 6JW",
                    "region": "London",
                    "title": "Billing address"
                },
                {
                    "country": "France",
                    "street_address": "40 rue d'Astorg",
                    "locality": "Paris",
                    "postal_code": "75008",
                    "region": "Ile-de-France",
                    "title": "Principal"
                }
              ]
      responses:
        '200':
          description: Return the array of addresses as passed
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
                  properties:
                    country:
                      type: string
                      description: Country
                    street_address:
                      type: string
                      description: Street address
                    default:
                      type: boolean
                      description: Returned only when the address is the default (`true`)
                    locality:
                      type: string
                      description: Locality
                    id:
                      type: integer
                      description: Address ID
                    postal_code:
                      type: string
                      description: Postal code
                    region:
                      type: string
                      description: Region
                    title:
                      type: string
                      description: Free label
              example: [
                {
                  "country": "United Kingdom",
                  "street_address": "39 London Rd",
                  "default": true,
                  "locality": "Southwark",
                  "id": 0,
                  "postal_code": "SE1 6JW",
                  "region": "London",
                  "title": "Billing address"
                },
                {
                  "country": "France",
                  "street_address": "40 rue d'Astorg",
                  "locality": "Paris",
                  "id": 1,
                  "postal_code": "75008",
                  "region": "Ile-de-France",
                  "title": "Principal"
                }
              ]
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v2/lite-users/USER_ID/addresses \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                "country": "France",
                "street_address": "40 Rue d'Astorg",
                "default": true,
                "locality": "Paris",
                "title": "Principal",
                "postal_code": "75008",
                "region": "Ile-de-France"
              }'
    delete:
      security:
        - OAuth2:
          - 'manage:users'
      tags:
        - Addresses
      summary: Delete user addresses (LITE)
      description: ''
      operationId: deleteLiteUserAddresses
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
      responses:
        '204':
          description: All user addresses have been deleted successfully
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request DELETE \
              --url https://YOUR_DOMAIN/api/v2/lite-users/USER_ID/addresses \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v2/lite-users/{userId}/addresses/{addressId}:
    get:
      security:
        - OAuth2:
          - 'read:users'
      tags:
        - Addresses
      summary: Get a user address (LITE)
      description: Get user address by ID.
      operationId: getLiteUserAddressByID
      parameters:
        - $ref: '#/components/parameters/userId'
        - $ref: '#/components/parameters/addressId'
      responses:
        '200':
          description: Return the specified user address
          content:
            application/json:
              schema:
                type: object
                properties:
                  country:
                    type: string
                    description: Country
                  street_address:
                    type: string
                    description: Street address
                  default:
                    type: boolean
                    description: Returned only when the address is the default (`true`)
                  locality:
                    type: string
                    description: Locality
                  id:
                    type: integer
                    description: Address ID
                  postal_code:
                    type: string
                    description: Postal code
                  region:
                    type: string
                    description: Region
                  title:
                    type: string
                    description: Free label
              example: {
                "country": "France",
                "street_address": "33 rue La Fayette",
                "locality": "Paris",
                "id": 1,
                "postal_code": "75009",
                "region": "Ile-de-France",
                "title": "Work"
              }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v2/lite-users/USER_ID/addresses/ADDRESS_ID \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                "country": "France",
                "street_address": "33 rue La Fayette",
                "locality": "Paris",
                "id": 1,
                "postal_code": "75009",
                "region": "Ile-de-France",
                "title": "Work"
              }'
    post:
      security:
        - OAuth2:
          - 'manage:users'
      tags:
        - Addresses
      summary: Update a user address (LITE)
      description: 'Update a user address (LITE).'
      operationId: updateLiteUserAddress
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
        - $ref: '#/components/parameters/addressId'
      requestBody:
        description: ''
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                country:
                  type: string
                  description: Country
                street_address:
                  type: string
                  description: Street address
                locality:
                  type: string
                  description: Locality
                postalCode:
                  type: string
                  description: Postal code
                region:
                  type: string
                  description: Region
                title:
                  type: string
                  description: Free label
              example: {
                "country": "France",
                "street_address": "255 Boulevard Pereire Ground",
                "locality": "Paris",
                "postal_code": "75017",
                "region": "Ile-de-France",
                "title": "Work"
              }
      responses:
        '200':
          description: Return the updated address with its ID
          content:
            application/json:
              schema:
                type: object
                properties:
                  country:
                    type: string
                    description: Country
                  street_address:
                    type: string
                    description: Street address
                  default:
                    type: boolean
                    description: Returned only when the address is the default (`true`)
                  locality:
                    type: string
                    description: Locality
                  id:
                    type: integer
                    description: Address ID
                  postal_code:
                    type: string
                    description: Postal code
                  region:
                    type: string
                    description: Region
                  title:
                    type: string
                    description: Free label
              example: {
                "country": "France",
                "street_address": "255 Boulevard Pereire Ground",
                "locality": "Paris",
                "id": 1,
                "postal_code": "75017",
                "region": "Ile-de-France",
                "title": "Work"
              }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v2/lite-users/USER_ID/addresses/ADDRESS_ID \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                "country": "France",
                "street_address": "255 Boulevard Pereire Ground",
                "locality": "Paris",
                "postal_code": "75017",
                "region": "Ile-de-France",
                "title": "Work"
              }'
  /api/v1/clients:
    get:
      security:
        - OAuth2:
          - 'read:clients'
      tags:
        - Clients
      summary: Get clients
      description: |
        Get specific information about clients.

      operationId: getClients
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/fields'
      responses:
        '200':
          description: Return an array of clients
          content:
            application/json:
              schema:
                type: array
                items:
                  type: object
              example:
                [
                    {
                        "name": "Default Client",
                        "type": "identity_first_party",
                        "allowed_callback_urls": [
                            "https://example.com/login/callback",
                        ],
                        "client_id": "nvR3y0ksRPOKEgCW2dqy"
                    },
                    {
                        "name": "Management",
                        "type": "management",
                        "client_id": "d4F1qGFMYAwTAGi58lU9"
                    },
                    {
                        "name": "Website Client",
                        "type": "identity_third_party",
                        "allowed_callback_urls": [
                            "https://example.com",
                        ],
                        "client_id": "oQPgSupG0mGyN2tO487Y"
                    }
                ]
        '403':
          description: Incorrect scopes
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFields'
                example:
                  {
                      "error_id": "55AYNPC7WI",
                      "error_description": "You are not granted to access this resource",
                      "error_message_key": "error.user.resource.accessNotGranted",
                      "error": "access_denied",
                      "error_user_msg": "You are not granted to access this resource"
                  }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v1/clients \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
    post:
      security:
      - OAuth2:
        - 'manage:clients'
      tags:
        - Clients
      summary: Create a client
      description: |
        Create a client.

      operationId: createClient
      parameters:
        - $ref: '#/components/parameters/Authorization'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: Client name
                  example: "Client Name"
                client_type:
                  type: string
                  enum:
                    - identity_first_party
                    - identity_third_party
                    - management
                  example: "identity_first_party"
                  description: |
                    Specifies the client type.

                    > **Note**: Use `identity_third_party` when using [OaaS](https://developer.reachfive.com/docs/oaas.html).
      responses:
        '200':
          description: Returns the properties of the created client.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/clientFields'
        '403':
          description: Incorrect client type
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFields'
                example:
                  {
                      "error_id": "FM6bn2JlJ7",
                      "error_details": [
                          {
                              "code": "invalid",
                              "field": "type",
                              "message": "Should be one of: identity_first_party,identity_third_party,management"
                          }
                      ],
                      "error_description": "Formulaire invalide",
                      "error_message_key": "error.invalidForm",
                      "error": "invalid_request",
                      "error_user_msg": "Formulaire invalide"
                  }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v1/clients \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                  "name": "Test",
                  "type": "identity_first_party"
              }'
  /api/v1/clients/{clientId}:
    get:
      security:
        - OAuth2:
          - 'read:clients'
      tags:
        - Clients
      summary: Get a client
      description: |
        Get specific information about a given client.

      operationId: getClient
      parameters:
        - name: clientId
          in: path
          description: ID of the ReachFive client
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/fields'
      responses:
        '200':
          description: Return a client object
          content:
            application/json:
              schema:
                type: object
              example:
                {
                    "enforces_scope": false,
                    "type": "management",
                    "client_id": "d4F1qGFMYAwTAGi58lU9",
                    "jwt_algorithm": "HS256",
                    "authentication_method": "client_secret_post",
                    "allowed_ip_addresses": [],
                    "is_implicit_flow_forbidden": true,
                    "scope": [
                        "export:facebook-likes",
                        "export:users",
                        "import:users",
                        "manage:clients",
                        "manage:consents",
                        "manage:users",
                        "read:clients",
                        "read:consents",
                        "read:facebook-likes",
                        "read:segments",
                        "read:user-events",
                        "read:users"
                    ],
                    "is_refresh_token_enabled": false,
                    "name": "Management",
                    "token_lifetime_in_seconds": 3600,
                    "client_secret": "YOUR_CLIENT_SECRET",
                    "allowed_origins": [
                    ]
                }
        '403':
          description: Incorrect scopes
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFields'
                example:
                  {
                      "error_id": "55AYNPC7WI",
                      "error_description": "You are not granted to access this resource",
                      "error_message_key": "error.user.resource.accessNotGranted",
                      "error": "access_denied",
                      "error_user_msg": "You are not granted to access this resource"
                  }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v1/clients/{clientId} \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                  "name": "Test",
                  "type": "identity_first_party"
              }'
    put:
      security:
        - OAuth2:
          - 'manage:clients'
      tags:
        - Clients
      summary: Update client
      description: |
        Update an Identity or a Management client.

      operationId: updateClient
      parameters:
        - name: clientId
          in: path
          description: ID of the ReachFive client
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/queryClientfields'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/clientFields'
      responses:
        '200':
          description: Return the properties of the updated client
          content:
            application/json:
              schema:
                type: object
              example:
                {
                  "all_scopes": [
                    "openid",
                    "address",
                    "email",
                    "phone",
                    "offline_access",
                    "profile",
                    "full_write",
                    "events"
                  ],
                  "custom_scopes": [
                    "favorite_player",
                    "favorite_team"
                  ],
                  "management_permissions": [
                    "read:consents",
                    "manage:users",
                    "read:clients",
                    "read:segments",
                    "import:users",
                    "export:facebook-likes",
                    "read:users",
                    "export:users",
                    "read:facebook-likes",
                    "read:user-events",
                    "manage:clients",
                    "manage:consents"
                  ],
                  "jwt_algorithm": "HS256",
                  "authentication_method": "client_secret_post",
                  "is_implicit_flow_forbidden": true,
                  "scope": [
                    "export:facebook-likes",
                    "export:users",
                    "import:users",
                    "manage:clients",
                    "manage:consents",
                    "manage:users",
                    "read:clients",
                    "read:consents",
                    "read:facebook-likes",
                    "read:segments",
                    "read:user-events",
                    "read:users"
                  ],
                  "is_refresh_token_enabled": false,
                  "name": "Management",
                  "token_lifetime_in_seconds": 3600,
                  "enforces_scope": false,
                  "client_id": "YOUR_CLIENT_ID",
                  "errors": [],
                  "allowed_ip_addresses": [],
                  "allowed_origins": [
                  ]
                }
        '404':
          description: Incorrect client id
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFields'
                example:
                  {
                      "error_id": "F4l850QbR3",
                      "error_description": "The client could not be found.",
                      "error_message_key": "error.client.notFound",
                      "error": "resource_not_found",
                      "error_user_msg": "The client could not be found."
                  }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request PUT \
              --url https://YOUR_DOMAIN/api/v1/clients/{clientId} \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                  "name": "Test",
                  "type": "identity_first_party"
              }'
    delete:
      security:
      - OAuth2:
        - 'manage:clients'
      tags:
        - Clients
      summary: Delete client
      description: |
        Delete an existing client.
      operationId: deleteClient
      parameters:
        - name: clientId
          in: path
          description: ID of the ReachFive client
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/Authorization'
      responses:
        '204':
          description: The client has been deleted successfully
        '404':
          description: Invalid client id
        '403':
          description: Incorrect scope
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFields'
                example:
                  {
                      "error_id": "A5BEDVZ9A0",
                      "error_description": "Scope insufficient. Expected: [manage:clients]",
                      "error_message_key": "error.accessToken.scope.insufficient",
                      "error": "access_denied",
                      "error_user_msg": "Scope insufficient. Expected: [manage:clients]"
                  }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request DELETE \
              --url https://YOUR_DOMAIN/api/v1/clients/{clientId} \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v1/clients/{clientId}/client-secret:
    get:
      security:
        - OAuth2:
          - 'manage:clients'
      tags:
        - Clients
      summary: Get client secret
      description: |
        Get client secret.

      operationId: getClientSecret
      parameters:
        - name: clientId
          in: path
          description: ID of the ReachFive client
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/Authorization'
      responses:
        '200':
          description: The client secret is returned
          content:
            application/json:
              schema:
                type: object
              example: {
                "value": "BLyws0cBtIQQDJ0tGBVTTL0ZJpU6D0saczjYnD8C"
              }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v1/clients/{clientId}/client-secret \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v1/clients/{clientId}/reset-client-secret:
    post:
      security:
        - OAuth2:
          - 'manage:clients'
      tags:
        - Clients
      summary: Reset client secret
      description: |
        Reset client secret. This removes the old client secret and generates a new client secret for the specified client.

      operationId: resetClientSecret
      parameters:
        - name: clientId
          in: path
          description: The ID of the ReachFive client.
          required: true
          schema:
            type: string
        - $ref: '#/components/parameters/Authorization'
      responses:
        '204':
          description: A new client secret has been generated successfully.
        '404':
          description: The client ID was not found.
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v1/clients/{clientId}/reset-client-secret \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v1/clients/public/permissions:
    get:
      security:
        - OAuth2:
          - 'read:clients'
      tags:
        - Clients
      description: |
        Get the list of client permissions.
      summary: Get client permissions
      operationId: getClientPermissions
      parameters:
        - $ref: '#/components/parameters/Authorization'
      responses:
        '200':
          description: OK
          content:
            application/json:
              example:
                [
                  "read:consents",
                  "manage:users",
                  "manage:custom-fields-schema",
                  "read:clients",
                  "read:segments",
                  "import:users",
                  "export:facebook-likes",
                  "read:users",
                  "export:users",
                  "read:facebook-likes",
                  "read:user-events",
                  "read:custom-fields-schema",
                  "manage:clients",
                  "manage:consents"
                ]
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v1/clients/public/permissions \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v1/site/keys:
    post:
      security:
        - OAuth2:
          - 'manage:settings'
      summary: Generate new account-based RSA key pair
      tags:
        - JWK Sets
      description: |
        Generates (rotates) a new account-based (global) RSA key pair.

        **Important**: Only those clients using the account-based (global) key pair will get a new key pair. Client-specific key pairs are not changed.
      operationId: postNewAccountKeyPair
      parameters:
        - $ref: '#/components/parameters/Authorization'
      responses:
        '200':
          description: |
            'OK'
             
            Returns the [JSON Web Key Set](https://developer.reachfive.com/docs/jwks.html#jwk-set-parameters).
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v1/site/keys \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /jwks.json:
    get:
      security:
        - OAuth2:
          - 'none'
      summary: Retrieve JWK set for account
      tags:
        - JWK Set
      description: Retrieves all keys for a JWK set for an account.
      operationId: getJWKSforAccount
      parameters:
        - $ref: '#/components/parameters/Authorization'
      responses:
        '200':
          description: |
            'OK'

            Returns the [JSON Web Key Set](https://developer.reachfive.com/docs/jwks.html#jwk-set-parameters).
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/jwks.json \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v1/clients/:clientId/keys:
    post:
      security:
        - OAuth2:
          - 'manage:clients'
      summary: Generate new RSA key pair for client
      tags:
        - JWK Sets
      description: Generates (rotates) a new RSA key pair for the specified client in the operation.
      operationId: generateRSAclient
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/clientId'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/jwkSets'
        '403':
          description: The client does not use RSA as its JWT algorithm.
        '404':
          description: The `:clientId` was not found.
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v1/clients/:clientId/keys \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
    put:
      security:
        - OAuth2:
          - 'manage:clients'
      summary: Sync client RSA key pair with account RSA key pair
      tags:
        - JWK Sets
      description: Synchronizes the client-specific RSA key pair back with the account-based (global) RSA key pair. This key pair is then added as a new JSON Web Key entry of the client's JWK Set.
      operationId: syncRSAglobal
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/clientId'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/jwkSets'
        '403':
          description: The client does not use RSA as its JWT algorithm.
        '404':
          description: The `:clientId` was not found.
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request PUT \
              --url https://YOUR_DOMAIN/api/v1/clients/:clientId/keys \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v1/clients/:clientId/jwks/:kid:
    delete:
      security:
        - OAuth2:
          - 'manage:clients'
      summary: Revoke key from JSON Web Key Set
      tags:
        - JWK Sets
      description: |
        Revoke a JSON Web Key for the specific client and key.

        **Caution**: You cannot revoke a JSON Web Key that is associated with the current client's active RSA key pair. If you try, you will receive a `403` error.
      operationId: deleteJWKSclient
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/clientId'
      responses:
        '200':
          description: 'OK'
        '403':
          description: | 
            'FORBIDDEN' 
             
             The JSON Web Key is currently in use in the client's configuration.
        '404':
          description: The `:clientId` was not found.
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request PUT \
              --url https://YOUR_DOMAIN/api/v1/clients/:clientId/keys \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v1/audit-logs:
    get:
      security:
        - OAuth2:
          - 'read:audit-logs'
      summary: Retrieve and search audit logs
      tags:
        - Audit Logs
      description: |
        Retrieve audit logs for a specific account.

        > **Filtering**:
        >
        > You can use the `filter` query parameter on the Audit Log object.
        > 
        > Example A: `/api/v1/audit-logs?filter=user_name=="Jose Rivera"`
        > 
        > Example B: `/api/v1/audit-logs?filter=action_name=="login"`
        > 
        > Example C: `/api/v1/audit-logs?filter=action_data.userId=="eYhY..1O1b"`

      operationId: searchAuditLogs
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/count'
        - $ref: '#/components/parameters/filter'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                description: Array of all the audit logs for an account.
                items:
                  $ref: '#/components/schemas/AuditLogs'
        '403':
          description: |
            Forbidden. You are not granted access to this resource.

            > **Note**: This is likely because you do not have the `read:audit-logs` scope as part of your access token.
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v1/audit-logs \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v2/lite-registration:
    put:
      security:
        - OAuth2:
          - 'manage:users'
      tags:
        - Users
      description: |
        Create a new LITE profile.

        > **Note**: You can update a lite profile with this endpoint. However, we strongly recommend you use
        > [Update lite profile](#operation/updateLiteProfile) for this instead.
      summary: Push a LITE profile
      operationId: pushLiteProfile
      parameters:
        - $ref: '#/components/parameters/Authorization'
      requestBody:
        content:
          application/json:
            schema:
              anyOf:
                - $ref: '#/components/schemas/LiteProfileEmail'
                - $ref: '#/components/schemas/LiteProfilePhone'
                - $ref: '#/components/schemas/LiteProfileExternalID'
            examples:
              With Email:
                value:
                  {
                    "email": "bruce.wayne@wayne.com",
                    "birthdate": "1981-10-13",
                    "nickname": "Batman"
                  }
              With phone number:
                value:
                  {
                    "phone_number": "+33672360203",
                    "birthdate": "1981-10-13",
                    "nickname": "Batman"
                  }
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  unified_id:
                    type: string
                    description: Unified user ID. This ID stays the same when a management profile is created under the same email adddress.
                    example: AXCfzMAknIXkLqWfO2L_
                  updated_at:
                    type: string
                    format: date-time
                    description: Last update timestamp
                  created_at:
                    type: string
                    format: date-time
                    description: Creation date timestamp.
                  id:
                    type: string
                    pattern: '[a-zA-Z0-9-_]{20}'
                    description: ReachFive user ID for the LITE profile. A separate user id is created when a management profile is created under the same email address.
                    example: AXCfzMAknIXkLqWfO2L_
                  timestamp:
                    type: string
                    format: date-time
                    description: Timestamp for the current operation.
                  lite_only:
                    type: boolean
                    description: |
                      A boolean that specifies the profile is LITE only.

                      - `true` = yes, the profile is LITE only.
                      - `false` = no, the profile is not LITE only.
                  lite_profile_fields:
                    type: object
                    description: Fields from the LITE profile model, passed in the request body.
              examples:
                With email:
                  value:
                    {
                      "unified_id": "AXCfyM5ZnIXkLqWfO2L8",
                      "birthdate": "1981-10-13",
                      "updated_at": "2020-03-03T09:45:02.283Z",
                      "nickname": "Batman",
                      "created_at": "2020-03-03T09:45:02.283Z",
                      "id": "AXCfyM5ZnIXkLqWfO2L8",
                      "lite_only": true,
                      "email": "bruce.wayne@wayne.com",
                      "timestamp": "2020-03-03T09:45:02.283Z"
                    }
                With phone number:
                  value:
                    {
                      "unified_id": "AXCfyM5ZnIXkLqWfO2L8",
                      "birthdate": "1981-10-13",
                      "updated_at": "2020-03-03T09:45:02.283Z",
                      "nickname": "Batman",
                      "created_at": "2020-03-03T09:45:02.283Z",
                      "phone_number": "+33672360203",
                      "id": "AXCfyM5ZnIXkLqWfO2L8",
                      "timestamp": "2020-03-03T09:45:02.283Z"
                    }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request PUT \
              --url https://YOUR_DOMAIN/api/v2/lite-registration \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                  "email": "bruce.wayne@wayne.com",
                  "birthdate": "1981-10-13",
                  "nickname": "Batman"
                }'
  /api/v2/lite-update/{id}:
    put:
      security:
        - OAuth2:
          - 'manage:users'
      description: |
        Update an existing lite profile.

        > **Tip**: To remove a field from a profile, set its value to `null`.
      summary: Update a LITE profile
      tags:
        - Users
      operationId: updateLiteProfile
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/fields'
        - name: id
          in: query
          required: true
          description: LITE profile ID
          example: AXCfyM5ZnIXkLqWfO2L8
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LiteProfileFields'
            example: {
              "birthdate": "1987-10-11",
              "nickname": null
            }
      responses:
        '200':
          description: Returns all of the LITE profile fields, or fields requested via the query string.
          content:
            application/json:
              examples:
                All fields (no ?fields):
                  value:
                    {
                      "auth_types": [],
                      "sub": "AXCgBE7nnIXkLqWfO2MI",
                      "birthdate": "1987-10-11",
                      "authorization_records": [],
                      "birth_month": 10,
                      "birth_date": "1987-10-10T23:00:00.000Z",
                      "lite_only": true,
                      "created_at": "2020-03-03T10:50:01.807Z",
                      "local_friends_count": 0,
                      "social_identities": [],
                      "likes_friends_ratio": 0,
                      "birth_year": 1987,
                      "logins_count": 0,
                      "provider_details": [],
                      "emails": {
                          "verified": [],
                          "unverified": [
                              "bruce.wayne@wayne.com"
                          ]
                      },
                      "uid": "AXCgBE7nnIXkLqWfO2MI",
                      "identities": [
                          {
                              "updated_at": "2020-03-03T10:50:33.857Z",
                              "provider": "lite",
                              "user_id": "AXCgBE7nnIXkLqWfO2MI",
                              "created_at": "2020-03-03T10:50:01.807Z",
                              "id": "lite:AXCgBE7nnIXkLqWfO2MI"
                          }
                      ],
                      "updated_at": "2020-03-03T10:50:33.857Z",
                      "origins": [],
                      "id": "AXCgBE7nnIXkLqWfO2MI",
                      "email": "bruce.wayne@wayne.com",
                      "has_password": false,
                      "email_verified": false,
                      "devices": [],
                      "custom_fields": {
                          "multiple_values": []
                      },
                      "birth_day": 11,
                      "has_managed_profile": false,
                      "providers": [],
                      "age": 32
                    }
                ID, email, birthdate:
                  value:
                    {
                        "birthdate": "1987-10-11",
                        "id": "AXCgBE7nnIXkLqWfO2MI",
                        "email": "bruce.wayne@wayne.com"
                    }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request PUT \
              --url https://YOUR_DOMAIN/api/v2/lite-udpate/ID \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                  "birthdate": "1987-10-11",
                  "nickname": null
                }'
  /api/v2/signup-invitations:
    post:
      security:
        - OAuth2:
          - 'manage:users'
      description: |
        Send a signup invitation link to the email addresses or phone number of Lite profiles. You have to send either a `phone_number` or `email` in the payload. Only one is required.

        > **Note**: The email message or SMS is configurable in the ReachFive console in the Signup invitation template.

        > **Tip**: See also [Signup data](identity.html#operation/getSignupData) to exchange signup invitation token and get user's informations.
        
      summary: Send signup invitations
      tags:
        - Users
      operationId: signupInvitation
      parameters:
        - $ref: '#/components/parameters/Authorization'
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/signupEmailInvite'
                - $ref: '#/components/schemas/signupSMSInvite'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  success:
                    type: array
                    description: List of email addresses matching those of Lite profiles. They will receive a signup invitation email. 
                    items:
                      type: string
                  existing_account:
                    type: array
                    description: List of email addresses matching those of registered user profiles. They will not receive a signup invitation email.
                    items:
                      type: string
                  not_found:
                    type: array
                    description: List of email addresses that doesn't match any existing profile (Lite or registered user). They will not receive a signup invitation email.
                    items:
                      type: string
                  error:
                    type: array
                    description: List of email addresses that couldn't be contacted.
                    items:
                      type: string
              example: {
                "success": ["bruce.wayne@wayne.com"],
                "existing_account": ["robin@wayne.com"],
                "error": [],
                "not_found": ["unknown@wayne.com"]
                       }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v2/signup-invitations \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data ' "emails": ["bruce.wayne@wayne.com","robin@wayne.com","unknown@wayne.com"],
                    "redirect_url": "https://client-account.reach5.net/signup"'
  /api/v2/passwordless/magic-link:
    post:
      security:
        - OAuth2:
          - 'manage:magic-links'
      description: |
        Create a magic link for users. This magic link can then be embedded where needed. For example, you could embed it as part of a marketing campaign.
        
      summary: Create magic link
      tags:
        - Passwordless
      operationId: createMagicLink
      parameters:
        - $ref: '#/components/parameters/Authorization'
      requestBody:
        content:
          application/json:
            schema:
                $ref: '#/components/schemas/createMagicLink'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  magic_link:
                    type: string
                    description: The magic link (passwordless login).
                    example: https://MAGIC_LINK?c=c&t=kas£kl0
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v2/passwordless/magic-link \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data ' "{...}'                
  /api/v2/lite-registration/consents:
    put:
      security:
        - OAuth2:
          - 'manage:users'
      description: |
        Updates consents for multiple lite profiles that match the query parameters.
        
        All query parameters are optional.

        - **Query the phone number**: `.../consents?phone_number="%2B33606060606"`
        - **Query the country code**: `.../consents?country_code="FR"`
        - **Filter by phone number**: `.../consents?filter=phone_number=="%2B33606060606"`
        - **Filter by email**: `.../consents?filter=email=="bruce.wayne%40wayne.com"`

        > **Notes**: Parameter values need to be URL encoded to match the `application/x-www-form-urlencoded` media type.
        >
        > To improve data quality and performance, consents will not be updated if the query matches more than *4* profiles.
        > 
        > It may also match *managed* profiles meaning that managed profiles are updated if matching as well.

        > **Warnings**:
        > 
        > If you provide both the `filter` query parameter and another parameter, they must be *exact* matches.
        > 
        > If you use `filter` with anything other than `phone_number` or `email`, the operation returns an error.
        
      summary: Update LITE consents
      tags:
        - 'Consents'
      operationId: updateLiteConsents
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/filter'
        - $ref: '#/components/parameters/phone_number'
        - $ref: '#/components/parameters/country_code'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                consents:
                  type: object
                  description: List of consents to update
                  additionalProperties:
                    x-additionalPropertiesName: key
                    type: object
                    description: The consent key
                    properties:
                      granted:
                        type: boolean
                        description: Whether users have granted consent
                      consent_type:
                        type: string
                        description: The consent type.
                        enum:
                        - opt-in
                        - opt-out
                      date:
                        type: string
                        format: date-time
                        description: 'Timestamp of the operation'
            example: {
              "consents": {
                "newsletter": {
                  "granted": true,
                  "consent_type": "opt-in",
                  "date": "2019-04-08T14:00:00Z"
                },
                "cgu": {
                  "date": "2019-05-26T12:19:42.022Z",
                  "granted": true,
                  "consent_type": "opt-in"
                },
              }
            }
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/updateLiteResponse'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFields'
              example:
                  {
                    "error_id": "Cgj8J8cfhX",
                    "error_description": "Too many matching profile: 7",
                    "error_message_key": "error.profile.tooManyMatching",
                    "error": "invalid_request",
                    "error_user_msg": "Too many matching profile: 7"
                  }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request PUT \
              --url https://YOUR_DOMAIN/api/v2/lite-registration/consents \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                "consents": {
                  "newsletter": {
                    "granted": true,
                    "consent_type": "opt-in",
                    "date": "2019-04-08T14:00:00Z"
                  },
                  "cgu": {
                    "date": "2019-05-26T12:19:42.022Z",
                    "granted": true,
                    "consent_type": "opt-in"
                  },
                }
              }'
  /api/v2/user-events:
    get:
      security:
        - OAuth2:
          - 'read:user-events'
      summary: Search user events
      tags:
        - User events
      description: |
        Search and retrieve a list of user events.

        > **Important**: There is a results limit of 10k in the search response.
        > **Tip**: If you need to see more than 10k results, we recommend [Exporting the data](https://developer.reachfive.com/docs/export-user-events.html).

      operationId: searchUserEvents
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/filter'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/count'
        - $ref: '#/components/parameters/sort'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserEvents'
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v2/user-events?filter=type=="login" \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v2/users/{userId}/events:
    get:
      security:
        - OAuth2:
          - 'read:user-events'
      summary: Search user events by user ID
      tags:
        - User events
      description: |
        Search and retrieve a list of user events by user ID.

        > **Important**: There is a results limit of 10k in the search response.
        > **Tip**: If you need to see more than 10k results, we recommend [Exporting the data](https://developer.reachfive.com/docs/export-user-events.html).
      operationId: searchUserEventsByUserID
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
        - $ref: '#/components/parameters/filter'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/count'
        - $ref: '#/components/parameters/sort'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserEvents'
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v2/users/USER_ID/events \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                  "birthdate": "1987-10-11",
                  "nickname": null
                }'
  /api/v1/consents:
    get:
      security:
      - OAuth2:
         - 'read:consents'
      summary: Get consents
      tags:
        - Consents
      description: 'List all consents configured for a ReachFive account.'
      operationId: getConsents
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/consent_fields'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/count'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                description: Array of consents
                items:
                  $ref: '#/components/schemas/Consent'
              example: [
                {
                  "key": "cgu",
                  "consent_type": "opt-in",
                  "tags": [
                    "web",
                    "weekly"
                  ],
                  "versions": [{
                      "version_id": 1,
                      "author_name": "auser@mailbox.com",
                      "translations": {
                        "en": {
                            "description": "I agree to the End User License Agreement.",
                            "title": "EULA"
                        }
                      }
                  }],
                  "status": "active",
                  "associated_consents": ["loyalty_card_program","endless_spam_program"]
                },
                {
                  "key": "billeterie",
                  "consent_type": "opt-in",
                  "tags": [
                    "weekly"
                  ],
                  "versions": [
                    {
                        "version_id": 2,
                        "author_name": "auser@mailbox.com",
                        "translations": {
                          "en": {
                              "description": "Tickets newsletter (on-sale dates, special offers).",
                              "title": "Tickets newsletter"
                          }
                        }
                    },
                    {
                      "version_id": 1,
                      "author_name": "auser@mailbox.com",
                      "translations": {
                        "en": {
                            "description": "Tickets newsletter.",
                            "title": "Tickets newsletter"
                        }
                      }
                    }
                  ],
                  "status": "active"
                }
              ]
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v1/consents \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
    post:
      security:
      - OAuth2:
         - 'manage:consents'
      summary: Create consents
      tags:
        - 'Consents'
      description: |
        Create a new consent for a ReachFive account.
        
        You can create standalone consents or a consent group.

        **Note**: Consent groups contains one or more standalone consents. When creating a consent group, you must pass the
        `associated_consents` array in the request payload.
      operationId: createConsents
      parameters:
        - $ref: '#/components/parameters/Authorization'
      requestBody:
        content:
          application/json:
            schema:
                $ref: '#/components/schemas/NewConsent'
            example:
              {
                "key": "end_user_agreement",
                "tags": [
                  "web",
                  "weekly"
                ],
                "status": "active",
                "consent_type": "opt-in",
                "translations": {
                  "en": {
                    "title": "I agree to the end user agreement.",
                    "description": "EULA"
                  }
                },
                "associated_consents": [
                  "string"
                ]
              }
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                  $ref: '#/components/schemas/Consent'
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v1/consents \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                  "key": "billeterie",
                  "consent_type": "opt-in",
                  "tags": [
                    "web",
                    "weekly"
                  ],
                  "translations": {
                    "fr": {
                        "description": "La newsletter billeterie (date d'ouvertures des ventes matchs, offres exclusives).",
                        "title": "Newsletter billeterie"
                    }
                  }
                }'
  /api/v1/consents/:key:
    get:
      security:
        - OAuth2:
          - 'read:consents'
      summary: Get a consent
      tags:
        - Consents
      description: 'Get information about a consent, identified by its unique key.'
      operationId: getConsent
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/key'
        - $ref: '#/components/parameters/consent_fields'
      responses:
        '200':
          description: Returns the consent object
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Consent'
              example: {
                "versions": [
                  {
                      "version_id": 2,
                      "author_name": "auser@mailbox.com",
                      "translations": {
                        "fr": {
                            "description": "La newsletter billeterie (date d'ouvertures des ventes matchs, offres exclusives).",
                            "title": "Newsletter billeterie",
                        },
                        "en": {
                            "description": "Tickets newsletter (on-sale dates, special offers).",
                            "title": "Tickets newsletter"
                        }
                      }
                  },
                  {
                    "version_id": 1,
                    "author_name": "auser@mailbox.com",
                    "translations": {
                      "fr": {
                          "description": "La newsletter billeterie",
                          "title": "Newsletter billeterie",
                      }
                    }
                  }
                ],
                "status": "active",
                "key": "billeterie",
                "consent_type": "opt-in",
                "tags": [
                    "web",
                    "weekly"
                  ],
              }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v1/consents/KEY \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
    put:
      security:
      - OAuth2:
         - 'manage:consents'
      summary: Update a consent
      tags:
        - 'Consents'
      description: |
        Update a consent or consent group.

        **Caution**: You can only update the consent's tags and versions once the consent is in production. However, you can edit the title and description of 
        a given translation *before* the consent is used in production.
      operationId: updateConsent
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/key'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EditableConsent'
            example: {
                "key": "billeterie",
                "consent_type": "opt-in",
                "tags": [
                  "web",
                  "weekly"
                ],
                "versions": [
                  {
                      "version_id": 1,
                      "author_name": "auser@mailbox.com",
                      "translations": {
                        "fr": {
                            "description": "La newsletter billeterie (date d'ouvertures des ventes matchs, offres exclusives).",
                            "title": "Newsletter billeterie"
                        }
                      }
                  }
                ],
                "status": "active",
                "associated_consents": ["standaloneConsent-keyA","standaloneConsent-keyB"]
              }
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Consent'
              example:
                {
                  "key": "billeterie",
                  "consent_type": "opt-in",
                  "tags": [
                      "web",
                      "weekly"
                    ],
                  "versions": [
                    {
                      "version_id": 2,
                      "author_name": "auser@mailbox.com",
                      "translations": [
                        "en": {
                            "description": "Tickets newsletter (on-sale dates, special offers).",
                            "title": "Tickets newsletter"
                        },
                        "es": {
                            "description": "Entradas newsletter (fechas de venta, ofertas esclusivas).",
                            "title": "Newsletter entradas"
                        }
                      ]
                    },
                    {
                      "version_id": 1,
                      "author_name": "auser@mailbox.com",
                      "translations": [
                        "en": {
                            "description": "Tickets newsletter.",
                            "title": "Tickets newsletter"
                        }
                      ]
                    }
                  ],
                  "status": "active"
                }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request PUT \
              --url https://YOUR_DOMAIN/api/v1/consents/KEY \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                "tags": [
                    "web",
                    "weekly"
                ],
                "versions": [
                  {
                    "version_id": 2,
                    "translations": [
                      "en": {
                          "description": "Tickets newsletter (on-sale dates, special offers).",
                          "title": "Tickets newsletter"
                      },
                      "es": {
                          "description": "Entradas newsletter (fechas de venta, ofertas esclusivas).",
                          "title": "Newsletter entradas"
                      }
                    ]
                  },
                  {
                    "version_id": 1,
                    "translations": [
                      "en": {
                          "description": "Tickets newsletter.",
                          "title": "Tickets newsletter"
                      }
                    ]
                  }
                ]
              }'
  /api/v1/consents/:key/status:
    put:
      security:
      - OAuth2:
          - 'manage:consents'
      summary: Update a consent's status
      tags:
        - 'Consents'
      description: Update the status of a consent, identified by its unique key.
      operationId: updateConsentStatus
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/key'
      requestBody:
        description: Pass the updated status in the request payload.
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ConsentStatus'
            example: {
                "status": "active"
              }
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Consent'
              example:
                {
                  "key": "billeterie",
                  "consent_type": "opt-in",
                  "tags": [
                      "web",
                      "weekly"
                    ],
                  "versions": [
                    {
                      "version_id": 2,
                      "author_name": "auser@mailbox.com",
                      "translations": [
                        "en": {
                            "description": "Tickets newsletter (on-sale dates, special offers).",
                            "title": "Tickets newsletter"
                        },
                        "es": {
                            "description": "Entradas newsletter (fechas de venta, ofertas esclusivas).",
                            "title": "Newsletter entradas"
                        }
                      ]
                    },
                    {
                      "version_id": 1,
                      "author_name": "auser@mailbox.com",
                      "translations": [
                        "en": {
                            "description": "Tickets newsletter.",
                            "title": "Tickets newsletter"
                        }
                      ]
                    }
                  ],
                  "status": "active"
                }
      x-codeSamples:
        - lang: 'cURL'
          source: |
            curl --request PUT \
              --url https://YOUR_DOMAIN/api/v1/consents/KEY/status \
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data-raw '"archived"'
  /api/v2/users/:uid/consent/doi-confirmation:
    post:
      security:
        - OAuth2:
          - 'manage:users'
          - 'read:consents'
      tags:
        - Consents
      summary: Send double opt-in confirmation
      description: |
        Sends a double opt-in confirmation request for all double opt-in consents for a user. 
        
        > #### <i class="fa fa-question-circle fa-2x" style="color: #00c24a"></i> What's a default channel?
        >
        > *If the SMS feature is enabled:*
        >
        > Users with mobile only or mobile and email, the default is via SMS.
        > 
        > Users with email only, the default is via email.
        >
        > *If the SMS feature is not enabled:*
        >
        > Users with email only or mobile and email, the default is via email.


        > **Important notes**:
        >
        > The consent must be active (not archived).
        > 
        > You can send a confirmation again only if the double opt-in consent status is `waiting_double_optin`.
        > 
        > You can't send a confirmation again if the double opt-in consent status is `rejected` or `accepted`.

      operationId: sendDoiConfirmation
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
      responses:
        '200':
          description: Successfully sent the DOI confirmation request to the user.
  /api/v2/users/:uid/consent/:key/doi-confirmation:
    post:
      security:
        - OAuth2:
          - 'manage:users'
          - 'read:consents'
      tags:
        - Consents
      summary: Send specific double opt-in confirmation
      description: |
        Send a double opt-in confirmation request to a user for a specific double opt-in consent (`:key`).

        > #### <i class="fa fa-question-circle fa-2x" style="color: #00c24a"></i> What's a default channel?
        >
        > *If the SMS feature is enabled:*
        >
        > Users with mobile only or mobile and email, the default is via SMS.
        > 
        > Users with email only, the default is via email.
        >
        > *If the SMS feature is not enabled:*
        >
        > Users with email only or mobile and email, the default is via email.

        > **Important notes**:
        >
        > The consent must be active (not archived).
        > 
        > You can send a confirmation again only if the double opt-in consent status is `waiting_double_optin`.
        > 
        > You can't send a confirmation again if the double opt-in consent status is `rejected` or `accepted`.
        
      operationId: sendSpecificDoiConfirmation
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
        - $ref: '#/components/parameters/key'
      responses:
        '200':
          description: Successfully sent the DOI confirmation request to the user.
        '400':
          description: |
            Bad request if any of the following are true:

            - The consent key does not exist.
            - The consent is not a double opt-in type.
            - The consent is archived.
  /api/v2/users/:uid/consent/:key/doi-confirmation/sms:
    post:
      security:
        - OAuth2:
          - 'manage:users'
          - 'read:consents'
      tags:
        - Consents
      summary: Send specific double opt-in confirmation via SMS
      description: |
        Send a double opt-in confirmation request to a user for a specific double opt-in consent (`:key`) via SMS.

        > **Important notes**:
        >
        > The consent must be active (not archived).
        > 
        > You can send a confirmation again only if the double opt-in consent status is `waiting_double_optin`.
        > 
        > You can't send a confirmation again if the double opt-in consent status is `rejected` or `accepted`.
        
      operationId: sendSpecificDoiConfirmationSms
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
        - $ref: '#/components/parameters/key'
      responses:
        '200':
          description: Successfully sent the DOI confirmation request to the user via SMS.
        '400':
          description: |
            Bad request if any of the following are true:

            - The consent key does not exist.
            - The consent is not a double opt-in type.
            - The consent is archived.
        '409':
          description: Conflict. User does not have a mobile associated with their account.
  /api/v2/users/:uid/consent/:key/doi-confirmation/email:
    post:
      security:
        - OAuth2:
          - 'manage:users'
          - 'read:consents'
      tags:
        - Consents
      summary: Send specific double opt-in confirmation via email
      description: |
        Send a double opt-in confirmation request to a user for a specific double opt-in consent (`:key`) via email.

        > **Important notes**:
        >
        > The consent must be active (not archived).
        > 
        > You can send a confirmation again only if the double opt-in consent status is `waiting_double_optin`.
        > 
        > You can't send a confirmation again if the double opt-in consent status is `rejected` or `accepted`.
        
      operationId: sendSpecificDoiConfirmationEmail
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/userId'
        - $ref: '#/components/parameters/key'
      responses:
        '200':
          description: Successfully sent the DOI confirmation request to the user via email.
        '400':
          description: |
            Bad request if any of the following are true:

            - The consent key does not exist.
            - The consent is not a double opt-in type.
            - The consent is archived.
        '409':
          description: Conflict. User does not have an email associated with their account.
  /api/v3/job-definitions:
    get:
      security:
        - OAuth2:
          - 'read:jobs'
      tags:
        - Jobs and job definitions
      summary: Search jobs definitions
      description: |
        Search jobs definitions

        > **Important**: There is a results limit of 10k in the search response.
      operationId: SearchJobsDefinitions
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/filter'
      responses:
        '200':
          description: Returns the list of all jobs definitions within the account
          content:
            application/json:
              schema:
                example: {
                          "settings": {
                              "criteria": [
                                  {
                                      "field": "age",
                                      "values": [
                                          35
                                      ],
                                      "operator": "GT"
                                  }
                              ],
                              "destination": {
                                  "settings": {
                                      "path": "/path/to/file",
                                      "password": "password",
                                      "port": 22,
                                      "host": "test.ip.net",
                                      "user": "user",
                                      "overwrite": false
                                  },
                                  "protocol": "SFTP"
                              },
                              "format": {
                                  "csv_config": {
                                      "quote_char": "\"",
                                      "delimiter": ";",
                                      "escape_char": "\\"
                                  },
                                  "csv_fields": [
                                      "addresses",
                                      "id",
                                      "email",
                                      "email_verified",
                                      "phone_number",
                                      "phone_number_verified",
                                      "username",
                                      "given_name",
                                      "middle_name",
                                      "family_name",
                                      "name",
                                      "nickname",
                                      "gender",
                                      "age",
                                      "birthdate",
                                      "birth_year",
                                      "birth_month",
                                      "birth_day",
                                      "external_id",
                                      "city",
                                      "country",
                                      "picture",
                                      "bio",
                                      "hometown",
                                      "locale",
                                      "education_level",
                                      "logins_count",
                                      "likes_count",
                                      "friends_count",
                                      "local_friends_count",
                                      "followers_count",
                                      "first_login",
                                      "last_login",
                                      "last_login_type",
                                      "likes_friends_ratio",
                                      "competition_hunter",
                                      "long_lived_tokens_revoked",
                                      "profile_url",
                                      "created_at",
                                      "updated_at",
                                      "timestamp",
                                      "lite_only",
                                      "has_password",
                                      "identities.linkedin.id",
                                      "identities.google.id",
                                      "identities.twitter.id",
                                      "identities.paypal.id",
                                      "identities.facebook.id",
                                      "identities.linkedin.updated_at",
                                      "identities.google.updated_at",
                                      "identities.twitter.updated_at",
                                      "identities.paypal.updated_at",
                                      "identities.facebook.updated_at",
                                      "custom_fields.string_value",
                                      "custom_fields.integer_value",
                                      "custom_fields.date_value"
                                  ],
                                  "format": "CSV",
                                  "encoding": "UTF-8"
                              },
                              "incremental": true
                          },
                          "updated_at": "2020-04-03T22:06:55.910Z",
                          "cron_expression": " 0 0 0/1 1/1 * ? *",
                          "name": "Global export",
                          "recovery_strategy": "NONE",
                          "description": "Export definition test",
                          "created_at": "2020-04-03T22:06:55.910Z",
                          "id": "AXFCFSusqbZzXmWk_Qkw",
                          "type": "export",
                          "enabled": true
                      }
      x-code-samples:
       - lang: 'cURL'
         source: |
          curl --request GET \
            --url https://YOUR_DOMAIN/api/v3/job-definitons \
            --header 'Content-type: application/json' \
            --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
    post:
      security:
        - OAuth2:
          - 'manage:jobs'
      tags:
        - Jobs and job definitions
      summary: Create a job definition
      description: |
        Create a job definition.
        
        In the request payload, choose either `settings.source` (for imports) or `settings.destination` for exports.

        > **For GCS jobs**: Because you are feeding a `JSON` object in a string value, you have to escape special characters. Here are some helpful tips:
        >
        > - Backspace to be replaced with `\b`
        > - Form feed to be replaced with `\f`
        > - Newline to be replaced with `\n`
        > - Carriage return to be replaced with `\r`
        > - Tab to be replaced with `\t`
        > - Double quote to be replaced with `\"`
        > - Backslash to be replaced with `\\`

      operationId: createJobDefinition
      parameters:
        - $ref: '#/components/parameters/Authorization'
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/jobDefinitionSFTP'
                - $ref: '#/components/schemas/jobDefinitionS3'
                - $ref: '#/components/schemas/jobDefinitionGCS'
      responses:
        '200':
          description: The job definition was created successfully.
          content:
            application/json:
              schema:
                oneOf:
                  - $ref: '#/components/schemas/jobDefinitionSFTP'
                  - $ref: '#/components/schemas/jobDefinitionS3'
                  - $ref: '#/components/schemas/jobDefinitionGCS'
      x-code-samples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v3/job-definitions \
              job-definitons
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
              --data '{
                "type" : "lite-email-deduplicator",
                "name" : "test email deduplication",
                "enabled" : true,
                "settings": {
                  "dry_run": false,
                  "bulk_size": 2000,
                  "parallelism": 4
                  }
                }'
  /api/v3/job-definitions/{job_definition_id}:
    get:
      security:
        - OAuth2:
          - 'read:jobs'
      tags:
        - Jobs and job definitions
      summary: Get a job definition
      description: 'Get a job definition'
      operationId: getJobDefinition
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/job_definition_id'
      responses:
        '200':
          description: Returns the job definition
          content:
            application/json:
              schema:
                example: {
                  "total": 1,
                  "items": [
                      {
                          "settings": {
                              "criteria": [
                                  {
                                      "field": "age",
                                      "values": [
                                          35
                                      ],
                                      "operator": "GT"
                                  }
                              ],
                              "destination": {
                                  "settings": {
                                      "path": "/path/to/file",
                                      "password": "password",
                                      "port": 22,
                                      "host": "test.ip.net",
                                      "user": "user",
                                      "overwrite": false
                                  },
                                  "protocol": "SFTP"
                              },
                              "format": {
                                  "csv_config": {
                                      "quote_char": "\"",
                                      "delimiter": ";",
                                      "escape_char": "\\"
                                  },
                                  "csv_fields": [
                                      "addresses",
                                      "id",
                                      "email",
                                      "email_verified",
                                      "phone_number",
                                      "phone_number_verified",
                                      "username",
                                      "given_name",
                                      "middle_name",
                                      "family_name",
                                      "name",
                                      "nickname",
                                      "gender",
                                      "age",
                                      "birthdate",
                                      "birth_year",
                                      "birth_month",
                                      "birth_day",
                                      "external_id",
                                      "city",
                                      "country",
                                      "picture",
                                      "bio",
                                      "hometown",
                                      "locale",
                                      "education_level",
                                      "logins_count",
                                      "likes_count",
                                      "friends_count",
                                      "local_friends_count",
                                      "followers_count",
                                      "first_login",
                                      "last_login",
                                      "last_login_type",
                                      "likes_friends_ratio",
                                      "competition_hunter",
                                      "long_lived_tokens_revoked",
                                      "profile_url",
                                      "created_at",
                                      "updated_at",
                                      "timestamp",
                                      "lite_only",
                                      "has_password",
                                      "identities.linkedin.id",
                                      "identities.google.id",
                                      "identities.twitter.id",
                                      "identities.paypal.id",
                                      "identities.facebook.id",
                                      "identities.linkedin.updated_at",
                                      "identities.google.updated_at",
                                      "identities.twitter.updated_at",
                                      "identities.paypal.updated_at",
                                      "identities.facebook.updated_at",
                                      "custom_fields.string_value",
                                      "custom_fields.integer_value",
                                      "custom_fields.date_value"
                                  ],
                                  "format": "CSV",
                                  "encoding": "UTF-8"
                              },
                              "incremental": true
                          },
                          "updated_at": "2020-04-03T22:06:55.910Z",
                          "cron_expression": " 0 0 0/1 1/1 * ? *",
                          "name": "Global export",
                          "recovery_strategy": "NONE",
                          "description": "Export definition test",
                          "created_at": "2020-04-03T22:06:55.910Z",
                          "id": "AXFCFSusqbZzXmWk_Qkw",
                          "type": "export",
                          "enabled": true
                      }
                  ]
              }
      x-code-samples:
       - lang: 'cURL'
         source: |
            curl --request GET \
            --url https://YOUR_DOMAIN/api/v3/job-definitons/JOB_ID \
            --header 'Content-type: application/json' \
            --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
    put:
      security:
        - OAuth2:
          - 'manage:jobs'
      tags:
        - Jobs and job definitions
      summary: Update a job definition
      description: |
        Update a job definition

        In the request payload, choose either `settings.source` (for imports) or `settings.destination` for exports.
      operationId: updateJobDefinition
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - in: path
          name: id
          required: true
          schema:
            type: string
            example: AXFCFSusqbZzXmWk_Qkw
          description: Job definition ID.
      requestBody:
        content:
          application/json:
            schema:
              oneOf:
                - $ref: '#/components/schemas/jobDefinitionSFTP'
                - $ref: '#/components/schemas/jobDefinitionS3'
                - $ref: '#/components/schemas/jobDefinitionGCS'
      responses:
        '204':
          description: The job definition was updated successfully.
    delete:
      security:
        - OAuth2:
          - 'manage:jobs'
      tags:
        - Jobs and job definitions
      summary: Delete a job definition
      description: Delete a job definition
      operationId: deleteJobDefinition
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - in: path
          name: id
          required: true
          schema:
            type: string
            example: AXFCFSusqbZzXmWk_Qkw
          description: Job definition ID.
      responses:
        '204':
          description: The job definition was deleted successfully.
  /api/v3/job-definitions/{job_definition_id}/run:
    post:
      security:
        - OAuth2:
          - 'execute:jobs'
          - 'manage:jobs'
      tags:
        - Jobs and job definitions
      summary: 'Run a job definition'
      description: 'Run a job definition'
      operationId: runJobDefinition
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/job_definition_id'
      responses:
        '202':
          description: The new job execution starts
          content:
            application/json:
              schema:
                type: object
                properties:
                  job_id:
                    description: The job definition ID.
                    type: string
                    example: AXzG3z...PI7sMNMb
                  status:
                    description: The status of the job definition. This defaults to `WAITING` when the job definition has successfully started.
                    type: string
                    example: WAITING
      x-code-samples:
        - lang: 'cURL'
          source: |
            curl --request POST \
              --url https://YOUR_DOMAIN/api/v3/job-definitions/JOB_DEFINITION_ID/run
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v3/job-definitions/{job_definition_id}/copy:
    post:
      security:
        - OAuth2:
          - 'manage:jobs'
      tags:
        - Jobs and job definitions
      summary: 'Copy job definition'
      description: 'Copy job definition'
      operationId: copyJobDefinition
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/job_definition_id'
      responses:
        '200':
          description: 'A new copy of the job definition is created'
          content:
            application/json:
              example:
                {
                  "settings": {
                      "criteria": [
                          {
                              "field": "age",
                              "values": [
                                  35
                              ],
                              "operator": "GT"
                          }
                      ],
                      "destination": {
                          "settings": {
                              "path": "/path/to/file",
                              "password": "password",
                              "port": 22,
                              "host": "test.ip.net",
                              "user": "user",
                              "overwrite": false
                          },
                          "protocol": "SFTP"
                      },
                      "format": {
                          "csv_config": {
                              "quote_char": "\"",
                              "delimiter": ";",
                              "escape_char": "\\"
                          },
                          "csv_fields": [
                              "addresses",
                              "id",
                              "email",
                              "email_verified",
                              "phone_number",
                              "phone_number_verified",
                              "username",
                              "given_name",
                              "middle_name",
                              "family_name",
                              "name",
                              "nickname",
                              "gender",
                              "age",
                              "birthdate",
                              "birth_year",
                              "birth_month",
                              "birth_day",
                              "external_id",
                              "city",
                              "country",
                              "picture",
                              "bio",
                              "hometown",
                              "locale",
                              "education_level",
                              "logins_count",
                              "likes_count",
                              "friends_count",
                              "local_friends_count",
                              "followers_count",
                              "first_login",
                              "last_login",
                              "last_login_type",
                              "likes_friends_ratio",
                              "competition_hunter",
                              "long_lived_tokens_revoked",
                              "profile_url",
                              "created_at",
                              "updated_at",
                              "timestamp",
                              "lite_only",
                              "has_password",
                              "identities.linkedin.id",
                              "identities.google.id",
                              "identities.twitter.id",
                              "identities.paypal.id",
                              "identities.facebook.id",
                              "identities.linkedin.updated_at",
                              "identities.google.updated_at",
                              "identities.twitter.updated_at",
                              "identities.paypal.updated_at",
                              "identities.facebook.updated_at",
                              "custom_fields.string_value",
                              "custom_fields.integer_value",
                              "custom_fields.date_value"
                          ],
                          "format": "CSV",
                          "encoding": "UTF-8"
                      },
                      "incremental": true
                  },
                  "updated_at": "2020-04-04T17:42:33.668Z",
                  "cron_expression": " 0 0 0/1 1/1 * ? *",
                  "name": "Global export (copy)",
                  "recovery_strategy": "NONE",
                  "description": "Export definition test",
                  "created_at": "2020-04-04T17:42:33.668Z",
                  "id": "AXFOzoqtVZqSJXUTqMqx",
                  "type": "export",
                  "enabled": false
              }
      x-code-samples:
        - lang: 'cURL'
          source: |
            curl --request POST \
             --url https://YOUR_DOMAIN/api/v3/job-definitions/JOB_ID/copy
             --header 'Content-type: application/json' \
             --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v3/job-definitions/{job_definition_id}/jobs:
    get:
      security:
        - OAuth2:
          - 'read:jobs'
      tags:
        - Jobs and job definitions
      summary: 'Get job executions from a job definition'
      description: 'Given a job definition ID, list all job executions run from the definition'
      operationId: getJobExecutionsFromDefinitionIDs
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/job_definition_id'
      responses:
        '200':
          description: Job execution list
          content:
            application/json:
              # schema:
                example: {
                  "total": 1,
                  "items": [
                      {
                          "updated_at": "2020-04-04T12:26:14.033Z",
                          "total_succeeded": 0,
                          "total_operations": 0,
                          "created_at": "2020-04-04T12:26:13.363Z",
                          "definition": {
                              "settings": {
                                  "criteria": [
                                      {
                                          "field": "age",
                                          "values": [
                                              35
                                          ],
                                          "operator": "GT"
                                      }
                                  ],
                                  "destination": {
                                      "settings": {
                                          "path": "/path/to/file",
                                          "password": "password",
                                          "port": 22,
                                          "host": "test.ip.net",
                                          "user": "user",
                                          "overwrite": false
                                      },
                                      "protocol": "SFTP"
                                  },
                                  "format": {
                                      "csv_config": {
                                          "quote_char": "\"",
                                          "delimiter": ";",
                                          "escape_char": "\\"
                                      },
                                      "csv_fields": [
                                          "addresses",
                                          "id",
                                          "email",
                                          "email_verified",
                                          "phone_number",
                                          "phone_number_verified",
                                          "username",
                                          "given_name",
                                          "middle_name",
                                          "family_name",
                                          "name",
                                          "nickname",
                                          "gender",
                                          "age",
                                          "birthdate",
                                          "birth_year",
                                          "birth_month",
                                          "birth_day",
                                          "external_id",
                                          "city",
                                          "country",
                                          "picture",
                                          "bio",
                                          "hometown",
                                          "locale",
                                          "education_level",
                                          "logins_count",
                                          "likes_count",
                                          "friends_count",
                                          "local_friends_count",
                                          "followers_count",
                                          "first_login",
                                          "last_login",
                                          "last_login_type",
                                          "likes_friends_ratio",
                                          "competition_hunter",
                                          "long_lived_tokens_revoked",
                                          "profile_url",
                                          "created_at",
                                          "updated_at",
                                          "timestamp",
                                          "lite_only",
                                          "has_password",
                                          "identities.linkedin.id",
                                          "identities.google.id",
                                          "identities.twitter.id",
                                          "identities.paypal.id",
                                          "identities.facebook.id",
                                          "identities.linkedin.updated_at",
                                          "identities.google.updated_at",
                                          "identities.twitter.updated_at",
                                          "identities.paypal.updated_at",
                                          "identities.facebook.updated_at",
                                          "custom_fields.string_value",
                                          "custom_fields.integer_value",
                                          "custom_fields.date_value"
                                      ],
                                      "format": "CSV",
                                      "encoding": "UTF-8"
                                  },
                                  "incremental": true
                              },
                              "updated_at": "2020-04-03T22:06:55.910Z",
                              "cron_expression": " 0 0 0/1 1/1 * ? *",
                              "name": "Global export",
                              "recovery_strategy": "NONE",
                              "description": "Export definition test",
                              "created_at": "2020-04-03T22:06:55.910Z",
                              "id": "AXFCFSusqbZzXmWk_Qkw",
                              "type": "export",
                              "enabled": true
                          },
                          "id": "AXFFJ9_8mOV_8aPmu7RU",
                          "total_failed": 0,
                          "type": "export",
                          "status": "SUCCESS"
                      }
                  ]
              }
      x-code-samples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v3/api/v3/job-definitions/JOB_DEFINITION_ID/jobs
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'
  /api/v3/jobs:
   get:
      security:
        - OAuth2:
          - 'read:jobs'
      tags:
        - Jobs and job definitions
      summary: Search jobs
      description: |
        Search jobs

        > **Important**: There is a results limit of 10k in the search response.
      operationId: SearchJobs
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/filter'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/count'
        - $ref: '#/components/parameters/sort'
      responses:
        '200':
          description: Returns the list of all jobs executions within the account
          content:
            application/json:
              schema:
                example: {
                             "total": 1,
                             "items": [
                               {
                                 "updated_at": "2020-09-10T15:27:35.477Z",
                                 "total_succeeded": 0,
                                 "total_operations": 0,
                                 "created_at": "2020-09-10T15:27:32.183Z",
                                 "definition": {
                                   "settings": {
                                     "criteria": [],
                                     "destination": {
                                       "settings": {
                                         "path": "/uploads/test-export.json",
                                         "password": "bwIH....m",
                                         "port": 22,
                                         "host": "sftp....net",
                                         "user": "r5...",
                                         "overwrite": true
                                       },
                                       "protocol": "SFTP"
                                     },
                                     "format": {
                                       "include_custom_fields": false,
                                       "format": "JSON",
                                       "encoding": "UTF-8"
                                     },
                                     "incremental": true
                                   },
                                   "updated_at": "2020-06-04T14:16:34.658Z",
                                   "name": "Test export update",
                                   "recovery_strategy": "NONE",
                                   "description": "Test export ",
                                   "created_at": "2020-06-04T14:16:34.658Z",
                                   "id": "AXJ_...xTyFw",
                                   "type": "export",
                                   "enabled": false
                                 },
                                 "id": "AXR4oQNj...4zl",
                                 "total_failed": 0,
                                 "type": "export",
                                 "status": "FAILURE"
                               }
                             ]
                           }
      x-code-samples:
       - lang: 'cURL'
         source: |
          curl --request GET \
            --url https://YOUR_DOMAIN/api/v3/jobs \
            --header 'Content-type: application/json' \
            --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'            
  /api/v3/jobs/{job_id}/logs:
    get:
      security:
        - OAuth2:
          - 'read:jobs'
      tags:
        - Jobs and job definitions
      summary: Get job execution logs
      description: |
        Get the logs for a specific job (by ID)

        **Note**: Retrieve the logs by the ID of the specific job that ran, not by a job definition ID.
      operationId: getJobLogs
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/count'
        - $ref: '#/components/parameters/sort'
        - $ref: '#/components/parameters/job_id'
      responses:
        '200':
          description: Returns an object containing an array of job execution logs.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/jobLogResponse'
              example: {
                        "total": 3,
                        "items": [
                                {
                                  "level": "LOG",
                                  "job_id": "AXryouGL...muFC_b4",
                                  "created_at": "2021-07-29T14:20:02.602Z",
                                  "id": "AXryovCuMywGolUnUYba",
                                  "content": "Import successful on line 2 for user AXryovA....olUnUYbZ"
                                },
                                {
                                  "level": "LOG",
                                  "job_id": "AXryouGL...muFC_b4",
                                  "created_at": "2021-07-29T14:20:02.674Z",
                                  "id": "AXryovEBMywGolUnUYbb",
                                  "content": "Job terminated in 2993ms"
                                },
                                {
                                  "level": "LOG",
                                  "job_id": "AXryouGL...muFC_b4",
                                  "created_at": "2021-07-29T14:20:02.612Z",
                                  "id": "AXryovDOWNNGkmuFC_b5",
                                  "content": "Imported 1 profile(s) with 0 line(s) in error"
                                }
                                ]
                        }
      x-code-samples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v3/jobs/JOB_ID/logs
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'                        
  /api/v3/jobs/{job_id}/logs/export:
    get:
      security:
        - OAuth2:
          - 'read:jobs'
      tags:
        - Jobs and job definitions
      summary: Export job execution logs
      description: |
        Export the logs for a specific job (by ID)

        **Note**: Retrieve the logs by the ID of the specific job that ran, not by a job definition ID.

      operationId: exportJobLogs
      parameters:
        - $ref: '#/components/parameters/Authorization'
        - $ref: '#/components/parameters/job_id'
        - $ref: '#/components/parameters/include_all_logs'
        - $ref: '#/components/parameters/format'
      responses:
        '200':
          description: Successfully exported jobs as either JSON or CSV
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/jobExportResponse'
        '404':
          description: Job not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorFields'
      x-code-samples:
        - lang: 'cURL'
          source: |
            curl --request GET \
              --url https://YOUR_DOMAIN/api/v3/jobs/JOB_ID/logs/export?include_all_logs=true&format=JSON
              --header 'Content-type: application/json' \
              --header 'Authorization: Bearer eyJ0eX...ll4Q2NT'                        
components:
  schemas:
    ipStatusObject:
      type: object
      properties:
        reports:
          type: object
          description: |
            A history of times when the IP was blocked.

            **Note**: If `reports` is empty, the IP has never been blocked.
          properties:
            expires:
              description: Specifies when the IP blocking expires.
              type: string
              example: "2023-11-21T13:51:50Z"
            created_at:
              description: Specifies when the IP blocking began.
              type: string
              example: "2023-11-25T13:51:50Z"
        banned:
          type: boolean
          description: |
            Boolean indicating if the IP is currently blocked.
          example: true
    requestSmsVerificationResponse:
      type: object
      properties:
        verification_code_sent:
          description: Boolean confirming if the `verification_code` was sent successfully or not.
          type: boolean
          example: true
    smsVerificationRequest:
      type: object
      properties:
        verification_code:
          description: Verification code the recipient must click to verify the phone number.
          type: string
          example: "X31ld0j"
      required:
        - verification_code
    getTrustedDevicesResponse:
      type: object
      properties:
        trusted_devices:
          type: array
          description: An array of trusted devices.
          items:
            type: object
            properties:
              id:
                description: The ID of the trusted device.
                type: string
                example: "k6ShT...Xu5uV0i"
              metadata:
                description: Information about the trusted device.
                type: object
                properties:
                  ip:
                    description: The device's IP address.
                    type: string
                    example: "185.209.222.60"
                  operatingSystem:
                    description: The operation system of the device.
                    type: string
                    example: "Windows 11"
                  userAgent:
                    description: The device's user agent information.
                    type: string
                    example: "Mozilla/5.0 (platform; rv:geckoversion) Gecko/geckotrail Firefox/firefoxversion"
                  deviceClass:
                    description: The device class.
                    type: string
                    example: "deviceClass"
                  deviceName:
                    description: The device name.
                    type: string
                    example: "deviceName"
              userId:
                description: The user's ID.
                type: string
                example: "teSh2...Wu5bV5L"
              createdAt:
                description: When the trusted device was added.
                type: string
                example: "2023-03-17T09:01:41.146Z"
    jobDefinitionSFTP:
      type: object
      properties:
        settings:
          type: object
          description: The object holding the settings.
          properties:
            criteria:
              description: Defined criteria for the job definition test.
              type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                    description: The specific user profile attribute to filter on.
                  values:
                    type: array
                    items:
                      type: string
                    description: The authorized values to filter on.
                    example: ["35","28"]
                  operator:
                    type: string
                    description: The operator itself.
                    example: "GT"
            parallelism:
              description: Indicates how many parallel jobs to be run simultaneously.
              type: integer
              example: 4
            for_deletion:
              description: Boolean indicating if the job is a deletion job or not.
              type: boolean
              example: true
            location_normalization:
              description: Boolean indicating whether to *normalize* the location or not.
              type: boolean
              example: true
            override_mode:
              description: Boolean indicating if you should force the data update from the file, regardless of whether `updated_at` is provided.
              type: boolean
              example: true
            format:
              description: The format object.
              type: object
              properties:
                csv_config:
                  description: The CSV configuration.
                  type: object
                  properties:
                    quote_char:
                      description: The type of quotation annotation for characters.
                      type: string
                      example: "\""
                    delimiter:
                      description: Specifies the delimiter such as `;`.
                      type: string
                      example: ";"
                    escape_char:
                      description: Specifies the type of escape character that should be used.
                      type: string
                      example: "\\"
                csv_fields:
                  description: The CSV fields.
                  type: array
                  items:
                    type: string
                format:
                  description: The format such as `CSV` or `JSON`.
                  type: string
                  example: CSV
                encoding:
                  description: The type of encoding such as `UTF-8`.
                  type: string
                  example: UTF-8
            lite_only:
              description: Boolean indicating if the job is for lite profiles only.
              type: boolean
              example: true
            bulk_size:
              description: Specifies the bulk size.
              type: integer
              example: 2000
            dry_run:
              description: Boolean indicating if it a dry run job or not.
              type: boolean
              example: false
            source:
              description: |
                This is the source where the protocol (such as SFTP) is defined and where the pertinent information such as `path`, `port`, `host`, etc. are entered.
              
                > **Note**: This is applicable to imports only; for exports, use `settings.destination`.
              type: object
              properties:
                settings:
                  description: The property settings objecct.
                  type: object
                  properties:
                    path:
                      description: The path for import. 
                      type: string
                      example: "/uploads/Archive_20190708/reach5_customer_without_pwd.csv"
                    password:
                      description: The SFTP password.
                      type: string
                      example: "sftp_password"
                    port:
                      description: The port.
                      type: integer
                      example: 22
                    host:
                      description: The host.
                      type: string
                      example: "sftp.company.net"
                    user:
                      description: The SFTP user name.
                      type: string
                      example: "sftp_user"
                    overwrite:
                      description: Boolean to overwrite existing file or not.
                      type: boolean
                      example: false
                protocol:
                  type: string
                  example: "SFTP"
            destination:
              description: |
                This is the destination where the export will go and where the pertinent information such as `path`, `port`, `host`, etc. are entered.
              
                > **Note**: This is applicable to exports only; for imports, use `settings.source`.
              type: object
              properties:
                settings:
                  description: The property settings object.
                  type: object
                  properties:
                    path:
                      description: The path for export. 
                      type: string
                      example: "/uploads/Archive_20190708/reach5_customer_without_pwd.csv"
                    password:
                      description: The SFTP password.
                      type: string
                      example: "sftp_password"
                    port:
                      description: The port.
                      type: integer
                      example: 22
                    host:
                      description: The host.
                      type: string
                      example: "sftp.company.net"
                    user:
                      description: The SFTP user name.
                      type: string
                      example: "sftp_user"
                    overwrite:
                      description: Boolean to overwrite existing file or not.
                      type: boolean
                      example: false
                protocol:
                  type: string
                  example: "SFTP"
            incremental:
              type: boolean
              description: |
                Boolean specifying if the job is incremental or not.

                > **Note**: This is only applicable to export jobs.
              example: true
            verbose:
              type: boolean
              example: true
        name:
          type: string
          description: The name of the job definition.
          example: "export database"
        recovery_strategy:
          type: string
          description: String describing the recovery strategy.
          example: NONE
        type:
          type: string
          description: |
            The type of job.

            This includes:

            - `import`
            - `export` (user profiles) [example JSON](https://developer.reachfive.com/openapi/_attachments/job-definitions/export-user-profiles.json)
            - `consent-export` [example JSON](https://developer.reachfive.com/openapi/_attachments/job-definitions/export-user-consents.json)
            - `user-events-export-external` [example JSON](https://developer.reachfive.com/openapi/_attachments/job-definitions/export-user-events.json)

          example: export
        enabled:
          type: boolean
          description: Boolean specifiying the job is enabled or not.
          example: false
        description:
          type: string
          description: Description of the job.
          example: "This job exports users every Friday at midnight."
    jobDefinitionS3:
      type: object
      properties:
        settings:
          type: object
          properties:
            criteria:
              description: Defined criteria for the job definition test.
              type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                    description: The specific user profile attribute to filter on.
                  values:
                    type: array
                    items:
                      type: string
                    description: The authorized values to filter on.
                    example: ["35","28"]
                  operator:
                    type: string
                    description: The operator itself.
                    example: "GT"
            parallelism:
              description: Indicates how many parallel jobs to be run simultaneously.
              type: integer
              example: 4
            for_deletion:
              description: Boolean indicating if the job is a deletion job or not.
              type: boolean
              example: true
            location_normalization:
              description: Boolean indicating whether to *normalize* the location or not.
              type: boolean
              example: true
            override_mode:
              description: Boolean indicating if you should force the data update from the file, regardless of whether `updated_at` is provided.
              type: boolean
              example: true
            format:
              description: The format object.
              type: object
              properties:
                csv_config:
                  description: The CSV configuration.
                  type: object
                  properties:
                    quote_char:
                      description: The type of quotation annotation for characters.
                      type: string
                      example: "\""
                    delimiter:
                      description: Specifies the delimiter such as `;`.
                      type: string
                      example: ";"
                    escape_char:
                      description: Specifies the type of escape character that should be used.
                      type: string
                      example: "\\"
                csv_fields:
                  description: The CSV fields.
                  type: array
                  items:
                    type: string
                format:
                  description: The format such as `CSV` or `JSON`.
                  type: string
                  example: CSV
                encoding:
                  description: The type of encoding such as `UTF-8`.
                  type: string
                  example: UTF-8
            lite_only:
              description: Boolean indicating if the job is for lite profiles only.
              type: boolean
              example: true
            bulk_size:
              description: Specifies the bulk size.
              type: integer
              example: 2000
            dry_run:
              description: Boolean indicating if it a dry run job or not.
              type: boolean
              example: false
            source:
              description: |
                This is the source where the protocol (such as S3) is defined and where the pertinent information such as `Url`, `Bucket`, `Region`, etc. are entered.
                
                > **Note**: This is applicable to imports only; for exports, use `settings.destination`.
              type: object
              properties:
                settings:
                  description: ''
                  type: object
                  properties:
                    Url:
                      description: The URL for the S3 bucket.
                      type: string
                      example: "https://my-bucket.s3.eu-central-1.amazonaws.com"
                    Bucket:
                      description: The S3 bucket.
                      type: string
                      example: "s3_bucket"
                    Region:
                      description: The region where the S3 bucket is located.
                      type: boolean
                      example: "eu-central-1"
                    Access key:
                      description: The AWS access key.
                      type: string
                      example: "access_key"
                    Secret key:
                      description: The AWS secret key.
                      type: string
                      example: "secret_key"
                    Path:
                      description: The path for import.
                      type: string
                      example: "/uploads/Archive_20220708/reach5_customer_s3.csv"
                    overwrite:
                      description: Boolean to overwrite the existing file or not.
                      type: boolean
                protocol:
                  type: string
                  example: "S3"
            destination:
              description: |
                This is the destination where the export goes and where the pertinent information such as `Url`, `Bucket`, `Region`, etc. are entered.
              
                > **Note**: This is applicable to exports only; for imports, use `settings.source`.
              type: object
              properties:
                settings:
                  description: ''
                  type: object
                  properties:
                    Url:
                      description: The URL for the S3 bucket.
                      type: string
                      example: "https://my-bucket.s3.eu-central-1.amazonaws.com"
                    Bucket:
                      description: The S3 bucket.
                      type: string
                      example: "s3_bucket"
                    Region:
                      description: The region where the S3 bucket is located.
                      type: boolean
                      example: "eu-central-1"
                    Access key:
                      description: The AWS access key.
                      type: string
                      example: "access_key"
                    Secret key:
                      description: The AWS secret key.
                      type: string
                      example: "secret_key"
                    Path:
                      description: The path for export.
                      type: string
                      example: "/uploads/Archive_20220708/reach5_customer_s3.csv"
                    overwrite:
                      description: Boolean to overwrite the existing file or not.
                      type: boolean
                protocol:
                  type: string
                  example: "S3"
            incremental:
              type: boolean
              description: |
                Boolean specifying if the job is incremental or not.

                > **Note**: This is only applicable to export jobs.
              example: true
            verbose:
              type: boolean
              example: true
        name:
          type: string
          description: The name of the job definition.
          example: "export database"
        recovery_strategy:
          type: string
          description: String describing the recovery strategy.
          example: NONE
        type:
          type: string
          description: |
            The type of job.

            This includes:

            - `import`
            - `export`
            - `consent-export`
            - `user-events-export-external`
          example: export
        enabled:
          type: boolean
          description: Boolean specifiying the job is enabled or not.
          example: false
        description:
          type: string
          description: Description of the job.
          example: "This job exports users every Friday at midnight."
    jobDefinitionGCS:
      type: object
      properties:
        settings:
          type: object
          properties:
            criteria:
              description: Defined criteria for the job definition test.
              type: array
              items:
                type: object
                properties:
                  field:
                    type: string
                    description: The specific user profile attribute to filter on.
                  values:
                    type: array
                    items:
                      type: string
                    description: The authorized values to filter on.
                    example: ["35","28"]
                  operator:
                    type: string
                    description: The operator itself.
                    example: "GT"
            parallelism:
              description: Indicates how many parallel jobs to be run simultaneously.
              type: integer
              example: 4
            for_deletion:
              description: Boolean indicating if the job is a deletion job or not.
              type: boolean
              example: true
            location_normalization:
              description: Boolean indicating whether to *normalize* the location or not.
              type: boolean
              example: true
            override_mode:
              description: Boolean indicating if you should force the data update from the file, regardless of whether `updated_at` is provided.
              type: boolean
              example: true
            format:
              description: The format object.
              type: object
              properties:
                csv_config:
                  description: The CSV configuration.
                  type: object
                  properties:
                    quote_char:
                      description: The type of quotation annotation for characters.
                      type: string
                      example: "\""
                    delimiter:
                      description: Specifies the delimiter such as `;`.
                      type: string
                      example: ";"
                    escape_char:
                      description: Specifies the type of escape character that should be used.
                      type: string
                      example: "\\"
                csv_fields:
                  description: The CSV fields.
                  type: array
                  items:
                    type: string
                format:
                  description: The format such as `CSV` or `JSON`.
                  type: string
                  example: CSV
                encoding:
                  description: The type of encoding such as `UTF-8`.
                  type: string
                  example: UTF-8
            lite_only:
              description: Boolean indicating if the job is for lite profiles only.
              type: boolean
              example: true
            bulk_size:
              description: Specifies the bulk size.
              type: integer
              example: 2000
            dry_run:
              description: Boolean indicating if it a dry run job or not.
              type: boolean
              example: false
            source:
              description: |
                This is the source where the protocol (such as GCS) is defined and where the pertinent information such as `project_id`, `app_name`, `bucket`, etc. are entered.

                > **Note**: This is applicable to imports only; for exports, use `settings.destination`.
              type: object
              properties:
                settings:
                  description: ''
                  type: object
                  properties:
                    project_id:
                      description: The GCS project ID.
                      type: string
                      example: GCS_project_ID
                    app_name:
                      description: The name of the GCS app.
                      type: string
                      example: GCS App
                    bucket:
                      description: The GCS storage bucket.
                      type: boolean
                      example: "GCS_bucket"
                    credentials:
                      description: |
                        The GCS credentials (in JSON format).

                        **Important**: Because you are feeding a `JSON` object in a string value, you have to escape special characters. Here are some helpful tips:

                        - Backspace to be replaced with `\b`
                        - Form feed to be replaced with `\f`
                        - Newline to be replaced with `\n`
                        - Carriage return to be replaced with `\r`
                        - Tab to be replaced with `\t`
                        - Double quote to be replaced with `\"`
                        - Backslash to be replaced with `\\`
                      type: string
                      example: "{client_id: \"CLIENT_ID\",\n client_secret: \"CLIENT_SECRET\"}"
                    path:
                      description: The path for import.
                      type: string
                      example: "/uploads/Archive_20220708/reach5_customer_gcs.csv"
                    overwrite:
                      description: ''
                      type: boolean
                      example: Boolean to overwrite existing file or not.
                protocol:
                  type: string
                  example: "GCS"
            destination:
              description: |
                This is the destination where the export goes where the pertinent information such as `project_id`, `app_name`, `bucket`, etc. are entered.
              
                > **Note**: This is applicable to exports only; for imports, use `settings.source`.
              type: object
              properties:
                settings:
                  description: ''
                  type: object
                  properties:
                    project_id:
                      description: The GCS project ID.
                      type: string
                      example: GCS_project_ID
                    app_name:
                      description: The name of the GCS app.
                      type: string
                      example: GCS App
                    bucket:
                      description: The GCS storage bucket.
                      type: boolean
                      example: "GCS_bucket"
                    credentials:
                      description: |
                        The GCS credentials (in JSON format).

                        **Important**: Because you are feeding a `JSON` object in a string value, you have to escape special characters. Here are some helpful tips:

                        - Backspace to be replaced with `\b`
                        - Form feed to be replaced with `\f`
                        - Newline to be replaced with `\n`
                        - Carriage return to be replaced with `\r`
                        - Tab to be replaced with `\t`
                        - Double quote to be replaced with `\"`
                        - Backslash to be replaced with `\\`
                      type: string
                      example: "{client_id: \"CLIENT_ID\",\n client_secret: \"CLIENT_SECRET\"}"
                    path:
                      description: The path for export.
                      type: string
                      example: "/uploads/Archive_20220708/reach5_customer_gcs.csv"
                    overwrite:
                      description: ''
                      type: boolean
                      example: Boolean to overwrite existing file or not.
                protocol:
                  type: string
                  example: "GCS"
            incremental:
              type: boolean
              description: |
                Boolean specifying if the job is incremental or not.

                > **Note**: This is only applicable to export jobs.
              example: true
            verbose:
              type: boolean
              example: false
        name:
          type: string
          description: The name of the job definition.
          example: "export database"
        recovery_strategy:
          type: string
          description: String describing the recovery strategy.
          example: NONE
        type:
          type: string
          description: |
            The type of job.

            This includes:

            - `import`
            - `export`
            - `consent-export`
            - `user-events-export-external`
          example: export
        enabled:
          type: boolean
          description: Boolean specifiying the job is enabled or not.
          example: false
        description:
          type: string
          description: Description of the job.
          example: "This job exports users every Friday at midnight."
    updateLiteResponse:
      type: array
      items:
        type: object
        properties:
          result:
            type: string
            description: Whether the update has failed (`error`) or succeeded (`success`).
            example: success
          id:
            type: string
            pattern: '[a-zA-Z0-9-_]{20}'
            description: 'ReachFive user ID targeted by the consent update'
            example: "AYQ...0O3H"
          updated:
            type: object
            description: An object containing the consents that were updated along with other profile information for the specified lite profile.
            properties:
              consents:
                type: object
                description: An object containing the updated consents.
                properties:
                  updatedConsent:
                    type: object
                    description: |
                      The specific updated consent containing the updated consent information.

                      **Note**: This will obviously vary depending on the consent that is updated.                     
    createMagicLink:
      type: object
      properties:
        email:
          type: string
          description: The user's email.
          example: "joeBlow@example.org"
        client_id:
          type: string
          description: The ReachFive Identity Client ID for which you want to create the magic link.
          example: "jQyN...asTGlj"
        response_type:
          type: string
          description: Specifies the response type.
          example: "token"
        scope:
          type: string
          description: List of space-delimited, case-sensitive strings representing the requested scope.
          example: "openid profile email phone address events favorite_player favorite_team full_write offline_access role"
        redirect_uri:
          type: string
          description: The URI where the user is redirected after clicking the magic link.
          example: "https://www.example.org/"
        lifetime:
          type: integer
          description: |
            The lifetime for the magic link in seconds. After this specified time, the magic link expires. If not specified, the maximum is used as the default lifetime.

            > **Note**: The maximum value for lifetime is `259200` (72 hours).
          example: 259200
        state:
          type: string
          description: |
            An opaque value used to maintain state between the request and callback.
            
            The authorization server includes this value when redirecting the user-agent back to the client.
          example: "879685"
      required:
        - email
        - client_id
        - response_type
        - scope
    retrieveAccessTokenResponse:
      type: object
      properties:
        access_token:
          type: string
          description: The access token itself.
          example: "eyJ0eXAiOiJKV1....f7LHmef4"
        expires_in:
          type: integer
          description: The time (in seconds) when the access token received in the response will expire.
          example: 3600
        token_type:
          type: string
          description: Specifies the type of token received.
          example: "Bearer"
    signupEmailInvite:
      type: object
      properties:
        emails:
          type: array
          items:
            type: string
          description: |
            List of email addresses to whom you want to send a signup invitation email.
            
            > Note: The number of identifiers (both email and SMS) is limited to `10,000` per request.
          example: ["bruce.wayne@gotham.com", "john.doe@example.com"]
        redirect_url:
          type: string
          description: |
            An optional URL to override the page users are sent to when they click on the invitation link.
            
            > Tip: The default redirect URL is found on your Reachfive Console at **Emails > Templates > Signup invitation > Redirect to**.
      required:
        - emails
    signupSMSInvite:
      type: object
      properties:
        phone_numbers:
          type: array
          items:
            type: string
          description: |
            List of phone numbers to whom you want to send a signup invitation SMS.
            
            > Note: The number of total identifiers (both SMS and email) is limited to `10,000` per request.
          example: ["+353871230000", "+353871230001"]
        redirect_url:
          type: string
          description: |
            An optional URL to override the page users are sent to when they click on the invitation link.
            
            > Tip: The default redirect URL (along with the URL lifetime) is defined on your Reachfive Console at **SMS > Templates > Signup invitation > Redirect to**.
      required:
        - phone_numbers
    jobExportResponse:
      type: object
      properties:
        Level:
          type: string
          description: Describes the level of the log such as `LOG` or `ERROR`.
          example: LOG
        Content:
          type: string
          description: Shows the content of the log; which typically describes what the log is.
          example: Job terminated in 190 ms
        Date:
          type: string
          description: The timestamp for when the job was run.
          example: "2022-12-16T22:30:05.058Z"
    jobLogResponse:
      type: object
      properties:
        total:
          type: string
          description: Specifies the total number of items in the object.
          example: "3"
        items:
          type: object
          properties:
            level:
              type: string
              description: The log level. This can be `LOG`, `INFO`, or `ERROR`.
              example: "LOG"
            job_id:
              type: string
              description: The specific job ID.
              example: "AXryouGL...muFC_b4"
            created_at:
              type: string
              description: The timestamp for when the job was executed. 
              example: "2021-07-29T14:20:02.602Z"
            id:
              type: string
              description: The job definition ID.
              example: "AXryovCuMywGolUnUYba"
            content:
              type: string
              description: A message about the job.
              example: "Import successful on line 2 for user AXryovA....olUnUYbZ"
    clientFields:
      type: object
      properties:
        name:
          type: string
          description: The name of the client.
          example: "Management Client"
        scope:
          type: array
          description: All scopes granted to the client.
          example: ["openid","address","email","offline_access"]
          items:
            type: string
        enforces_scope:
          type: boolean
          description: Boolean that specifies if scope is enforced or not.
          example: true
        authentication_method:
          type: string
          description: Specifies the authentication method for the client.
          example: client_secret_post
        allowed_origins:
          type: array
          description: The `allowed_origins` for the client.
          example: ["https://localhost:3000"]
          items:
            type: string
        allowed_callback_urls:
          type: array
          description: The `allowed_callback_urls` for the client.
          example: ["https://localhost:3000"]
          items:
            type: string
        allowed_ip_addresses:
          type: array
          description: The `allowed_ip_addresses` for the client.
          example: ["172.18.0.2"]
          items:
            type: string
        pcke_enforced:
          type: boolean
          description: Boolean that declares if PKCE is enforced or not.
          example: true
        pkce_enabled:
          type: boolean
          description: Boolean that declares if PKCE is enabled or not.
          example: true
        token_lifetime_in_seconds:
          type: integer
          description: Specifies how long the token is valid for in seconds.
          example: 86400
        is_refresh_token_enabled:
          type: boolean
          description: Boolean that specifies if refresh tokens are enabled.
          example: true
        refresh_token_lifetime_in_seconds:
          type: integer
          description: Specifies how long the refresh token is valid for in seconds.
          example: 432000
        login_url:
          type: string
          description: The login URL.
          example: "https://www.example.com/login"
        jwt_algorithm:
          type: string
          description: Specifies the JWT algorithm.
          enum:
            - "HS256"
            - "RS256"
          example: "HS256"
        is_implicit_flow_forbidden:
          type: boolean
          description: Boolean that specifies if the implicit flow is forbidden.
          example: true
        consent_page_settings:
          type: object
          description: An object containing the consent settings.
          properties:
            logo_settings:
              type: object
              description: An object containing the file ID and path for the logo.
              properties:
                  fileid:
                    type: string
                    description: The file ID for the logo.
                    example: "AXD...x61"
                  filepath:
                    type: string
                    description: The file path for the logo.
                    example: "/path/"
            website_url:
              type: string
              description: The website URL.
              example: "https://example.com"  
    updateUserFields:
      type: object
      properties:
        email:
          type: string
          description: The user's email.
          example: "blah@example.blah"
        phone_number:
          type: string
          description: The user's phone number.
          example: "+353123456700"
        external_id:
          type: string
          description: The user's external ID.
          example: "2977460"
        email_verified:
          type: boolean
          description: '`true` if the email has been verified.'
          example: true
        phone_number_verified: 
          type: boolean
          description: '`true` if the phone number has been verified.'
          example: true
        given_name:
          type: string
          description: Given name(s) or first name(s).
          example: "James"
        middle_name:
          type: string
          description: Middle name(s).
          example: "Richard"
        family_name:
          type: string
          description: Surname(s) or last name(s).
          example: "O'Mahony"
        name:
          type: string
          description: Full user name.
          example: James Richard O'Mahony
        nickname:
          type: string
          description: Casual name that may or may not be the same as the `given_name`.
          example: "Little James"
        updated_at:
          type: string
          description: |
            When passed as part of the payload, `updated_at` is valued with the request payload.

            If the date is in the future, it falls back to the date the operation was executed.

            > **Example:**
            > 
            > Operation occurs at (a) `2023-06-17T09:01:41.146Z` and the `updated_at` value is (b) `2023-12-17T09:01:41.146Z`, the final `updated_at` value is (a).
            > 
            > Operation occurs at (a) `2023-06-17T09:01:41.146Z` and the `updated_at` value is (b) `2023-05-17T09:01:41.146Z`, the final `updated_at` value is (b).
          example: "2023-06-17T09:01:41.146Z"
        username:
          type: string
          description: Username
          example: jromahony
        birthdate:
          type: string
          description: User’s birthdate, represented as an ISO 8601 YYYY-MM-DD format.
          example: "1983-11-13"
        gender:
          type: string
          description: User’s gender.
          enum:
            - female
            - male
            - other
          example: male
        addresses:
          type: object
          description: User postal addresses.
        picture:
          type: string
          description: URL to the profile picture
          example: "https://www.facebook.com/app_scoped_user_id/10154500298019865/"
        company:
          type: string
          description: User company name.
          example: "ACME"
        custom_fields:
          type: object
          description: Custom fields.
        consents:
          type: object
          description: Consents.
        redirect_url:
          type: string
          description: |
            The URL to which the user is redirected after updating their email.

            > **Note**: This overrides the default redirect URL set in the update confirmation email.
          example: https://www.example.com/redirect
    ErrorFields:
      type: object
      properties:
        error_id: 
          type: string
          description: The technical ID of the error.
        error_description:
          type: string
          description: The default description message for the error.
        error: 
          type: string
          description: Specifies the main error category.
        error_user_msg:
          type: string
          description: The user friendly error message. This should be displayed in the UI and can be overloaded in some configurations. This is bound to a specific `i18n` translation.
        error_message_key:
          type: string
          description: The error message key that can be used to bind specific behaviors on other services. This also acts as the `i18n` translation key.
    Address:
      type: object
      properties:
        country:
          type: string
          description: Country
        street_address:
          type: string
          description: Street address
        locality:
          type: string
          description: Locality
        postal_code:
          type: string
          description: Postal code
        region:
          type: string
          description: Region
        title:
          type: string
          description: Free label
    LiteProfileEmail:
      allOf:
      - required: [email]
      - $ref: '#/components/schemas/LiteProfileFields'
      - type: object
    LiteProfilePhone:
      allOf:
        - required: [phone_number]
        - $ref: '#/components/schemas/LiteProfileFields'
        - type: object
    LiteProfileExternalID:
      allOf:
        - required: [external_id]
        - $ref: '#/components/schemas/LiteProfileFields'
        - type: object
    LiteProfileFields:
      type: object
      properties:
        email:
          type: string
          description: Email
        phone_number:
          type: string
          description: Phone Number
        external_id:
          type: string
          description: External ID
        name:
          type: string
          description: Full user name.
        given_name:
          type: string
          description: Given name(s) or first name(s).
        family_name:
          type: string
          description: Surname(s) or last name(s).
        middle_name:
          type: string
          description: Middle name(s).
        nickname:
          type: string
          description: Casual name that may or may not be the same as the `given_name`.
        updated_at:
          type: string
          description: |
            When passed as part of the payload, `updated_at` is valued with the request payload.

            If the date is in the future, it falls back to the date the operation was executed.

            > **Example:**
            > 
            > Operation occurs at (a) `2023-06-17T09:01:41.146Z` and the `updated_at` value is (b) `2023-12-17T09:01:41.146Z`, the final `updated_at` value is (a).
            > 
            > Operation occurs at (a) `2023-06-17T09:01:41.146Z` and the `updated_at` value is (b) `2023-05-17T09:01:41.146Z`, the final `updated_at` value is (b).
        gender:
          type: string
          description: User’s gender.
          enum:
            - female
            - male
            - other
        birthdate:
          type: string
          description: User’s birthdate, represented as an ISO 8601 YYYY-MM-DD format.
        picture:
          type: string
          description: URL to the profile picture
        company:
          type: string
          description: User company name.
        addresses:
          items:
            type: object
          description: User postal addresses.
        custom_fields:
          type: object
          description: Custom fields.
        consents:
          type: object
          description: Consents.
    ProfileFields:
      type: object
      properties:
        email:
          type: string
          description: Email
        phone_number:
          type: string
          description: Phone Number
        external_id:
          type: string
          description: External ID
        email_verified:
          type: boolean
          description: '`true` if the email has been verified.'
        phone_number_verified:
          type: boolean
          description: '`true` if the phone number has been verified.'
        given_name:
          type: string
          description: Given name(s) or first name(s).
        middle_name:
          type: string
          description: Middle name(s).
        family_name:
          type: string
          description: Surname(s) or last name(s).
        name:
          type: string
          description: Full user name.
        nickname:
          type: string
          description: Casual name that may or may not be the same as the `given_name`.
        updated_at:
          type: string
          description: |
            When passed as part of the payload, `updated_at` is valued with the request payload.

            If the date is in the future, it falls back to the date the operation was executed.

            > **Example:**
            > 
            > Operation occurs at (a) `2023-06-17T09:01:41.146Z` and the `updated_at` value is (b) `2023-12-17T09:01:41.146Z`, the final `updated_at` value is (a).
            > 
            > Operation occurs at (a) `2023-06-17T09:01:41.146Z` and the `updated_at` value is (b) `2023-05-17T09:01:41.146Z`, the final `updated_at` value is (b).
        username:
          type: string
          description: Username
        birthdate:
          type: string
          description: User’s birthdate, represented as an ISO 8601 YYYY-MM-DD format.
        gender:
          type: string
          description: User’s gender.
          enum:
            - female
            - male
            - other
        addresses:
          type: object
          description: User postal addresses.
        picture:
          type: string
          description: URL to the profile picture
        company:
          type: string
          description: User company name.
        custom_fields:
          type: object
          description: Custom fields.
        consents:
          type: object
          description: Consents.
    AuditLogs:
      type: object
      properties:
        user_email:
          type: string
          description: The user email for the associated account.
          example: user@example.com
        entity_name:
          type: string
          description: |
            The type of audit log.

            > Possible values:
            > - `clients`
            > - `console`
            > - `jobs`
            > - `settings`
          example: "jobs"
        client_id:
          type: string
          description: The client ID associated with the specific audit log.
          example: "jQyN...asTGlj"
        user_name:
          type: string
          description: The account user name.
          example: "Don Quixote"
        action_name:
          type: string
          description: The type of action or trigger for the audit log.
          example: "create"
        created_at:
          type: string
          format: date-time
          description: Creation date timestamp for the audit log.
          example: "2021-09-09T09:21:22.107809Z"
        id:
          type: string
          description: The audit log's unique ID.
          example: "1b32e19c-2134-459b-8928-e0880f0fd636"
        action_data:
          type: object
          description: |
            Any associated action data. The data here depends on the `entity_name`.

            *clients*:

            - `clientId`
            - `updatedKeys`

            *console*: `action_data` is empty.

            *jobs*:

            - `jobType`
            - `updatedKeys`
            - `jobDefinitionId`

            *settings*:

            - `settingsType`
            - `securitySettingsKeysChanged`
          example: {
                "jobType": "import",
                "updatedKeys": [
                    "settings.lite_only",
                    "updated_at"
                ],
                "jobDefinitionId": "AXy...VwcUnl"
            }
    UserEvents:
      type: object
      properties:
        total:
          type: integer
          description: Number of user events
        items:
          type: array
          description: Array of user event objects
          items:
            type: object
            properties:
              id:
                type: string
                description: User event ID
              type:
                type: string
                description: User event type
              user_id:
                type: string
                pattern: '[a-zA-Z0-9-_]{20}'
                description: ReachFive user ID
              date:
                type: string
                format: date-time
                description: Timestamp of the event
              client_id:
                type: string
                description: ReachFive client ID
              device:
                type: string
                enum:
                - desktop
                - ios
                - android
                - windows_phone
                - mobile_web
                description: Device type
              auth_type:
                type: string
                description: Authentication type
                # enum:
                #   - password
                #   - phone_number_password
                #   - magic_link
                #   - sms
                #   - external
                #   - refresh
                #   - login_as
                #   - third_party
              user_agent:
                type: string
                description: The user agent
      example: {
        "total": 2,
        "items": [
          {
            "id": "AWUTz06ZD6KwGSiAAIMR",
            "type": "login",
            "user_id": "AWUTz0JBD6KwGSiAAIMH",
            "date": "2018-08-07T09:54:34.183Z",
            "client_id": "sg48CdAYohRPeRWZ9j1H",
            "device": "desktop",
            "auth_type": "facebook",
            "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60"
          },
          {
            "id": "AWUTz0naD6KwGSiAAIMN",
            "type": "signup",
            "user_id": "AWUTz0JBD6KwGSiAAIMH",
            "date": "2018-08-07T09:54:34.183Z",
            "client_id": "sg48CdAYohRPeRWZ9j1H",
            "device": "desktop",
            "auth_type": "facebook",
            "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Mobile/14G60"
          }
        ]
      }
    jwkSets:
      type: object
      properties:
        allowed_callback_urls:
          type: array
          description: The `allowed_callback_urls` specified for the client.
          items:
            type: string
        allowed_origins:
          type: array
          description: The `allowed_origins` specified for the client.
          items:
            type: string
        authentication_method:
          type: string
          description: Specifies the authentication method used to retrieve the JWK Set.
        client_id:
          type: integer
          description: The client ID.
        client_secret:
          type: integer
          description: The client secret.
        enforces_scope:
          type: boolean
          description: Boolean that specifies if scope is enforced or not.
        is_implicit_flow_forbidden:
          type: boolean
          description: Boolean that specifies if the implicit flow is forbidden.
        is_refresh_token_enabled:
          type: boolean
          description: Boolean that specifies if refresh tokens are enabled.
        jwk_set:
          type: object
          description: An object containing the information about each key in the key set. See [JWK Set parameters](https://developer.reachfive.com/docs/jwks.html#jwk-set-parameters) for more details.
      example: {
          "allowed_callback_urls" : [],
          "allowed_origins" : [],
          "authentication_method" : "client_secret_post",
          "client_id" : "YV3OaJ6RueolwOnAOHwl",
          "client_secret" : "RtHL5Q4hTWMSLQ1gBj2Qn0hoktJMb3gmo3e0GM9l",
          "enforces_scope" : true,
          "is_implicit_flow_forbidden" : false,
          "is_refresh_token_enabled" : false,
          "jwk_set" : {
              "keys": [
                    {
                      "kty": "RSA",
                      "e": "AQAB",
                      "x5t": "MTJiMmJiMDY3YTgyYzk2MGJhMmYxZDVjYTUzMWJkYTAwOWYyOWMzMg",
                      "use": "sig",
                      "kid": "c5a1b386-fbd7-4f66-9652-286127b3828c",
                      "x5c": [
                        "MIICujCCAaKgAwIBAgIEQWoDeDANBgkqhkiG9w0BAQsFADAfMR0wGwYDVQQDExR0ZXN0LWFsZXgucmVhY2g1Lm5ldDAeFw0yMDA3MjkwOTM0MjlaFw0yMjAyMjQxMjA2MDBaMB8xHTAbBgNVBAMTFHRlc3QtYWxleC5yZWFjaDUubmV0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAlzRszUeQ4WiSqvmYxMP10ngm8ALIoUwMH7Oa8vrZgD5pqalPjetPAxeVcAv2gTyDlOwtB0fGvlQo6n78pd9pTbgrzUjhmFuYN6OCfT6eN/2wu0LmwryFS2mbh7/1DTiKd2tZaRalskPECXTKkeks85HVqanB0860BYlGvQvfgrvhCWXXFJJeXvNwYNFYdDdrFQhoeOAEvRDKg9DdHZf6XzSR6Qk3w51FKn2b7imen/G52itD/kIen1hqqB2Jwt9SWyX5MSGySY2QwC18F6Dfs8L+t0mwCo6grGW9264Z5vlO0PWssEqGIX/ez6nk1ZdHXhoXwJ0W+6QzeQlUN8jNoQIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQBtFiGWZNOa4L2A9C0e8QM65oqA4FzCKtfrtc7kZhWzCykZyPvozuQhU+8u40oIZxTMjHPbZGei4JiZZ0LjP44B9ss66/eKrw7rO6FZFFMPw+97BV6kgf6FWWmoHCP28DzsfxLnBaqUdE7yX2Oj9fB01+leyD5npjvGRjknakpoDIsuSanBjVMBR6PLwMBpMyrhl+mOxQAnBy4NxuwMekC7R6v1xYk+z6+hWb00ke+KRBveDQebupVLivTPAWsELaSS76hcd9gFXdh4CaTQox7Dt2pjMeoBgulU2Ui/6oLXy6Jh1atfyNaXd1OMMulHB/4Lo+8opjTN/lpMBrBO1jEl"
                        ],
                      "alg": "RS256",
                      "n": "lzRszUeQ4WiSqvmYxMP10ngm8ALIoUwMH7Oa8vrZgD5pqalPjetPAxeVcAv2gTyDlOwtB0fGvlQo6n78pd9pTbgrzUjhmFuYN6OCfT6eN_2wu0LmwryFS2mbh7_1DTiKd2tZaRalskPECXTKkeks85HVqanB0860BYlGvQvfgrvhCWXXFJJeXvNwYNFYdDdrFQhoeOAEvRDKg9DdHZf6XzSR6Qk3w51FKn2b7imen_G52itD_kIen1hqqB2Jwt9SWyX5MSGySY2QwC18F6Dfs8L-t0mwCo6grGW9264Z5vlO0PWssEqGIX_ez6nk1ZdHXhoXwJ0W-6QzeQlUN8jNoQ"
                      },
                    {
                      "kty": "RSA",
                      "e": "AQAB",
                      "x5t": "MGVlMTQxNjA5NDZjODMzMzViZTUxZjY3YWE2Yjg4YzM1YmNlZWIzYQ",
                      "use": "sig",
                      "kid": "125db4c0-2813-4007-9a54-ed74de8d01a9",
                      "x5c": [
                        "MIICujCCAaKgAwIBAgIEJX2XpjANBgkqhkiG9w0BAQsFADAfMR0wGwYDVQQDExR0ZXN0LWFsZXgucmVhY2g1Lm5ldDAeFw0yMTAyMjQxMjA1NDZaFw0yMjAyMjQxMjA1NDZaMB8xHTAbBgNVBAMTFHRlc3QtYWxleC5yZWFjaDUubmV0MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAmf9n9WuaNt51HfjyQwTvkLu8CGTPcJ2mJbbg70VxcbuSdF0KO5n12ht3xeqCditCrUVmTbin+B4W1+sQa/FtjRs+YhzcCUyuQsBuXDfZ/bhA9JurL79/sbplbXCbuG8uN3WIen6woIsqBpl7/Y0Jm4DFQHtBoU3DGunLapjWtawTRDdcWWI75HaQkkxfTzZDa+y14XYhJqz9Er9SaB2wo0XLwB8XuH+s2UfELWuv+iGHvigHvxJmeoGOaCzunwaKgoJXkcU+8thnu4g4dIhcTpz1i5Oc7tEVSwLnhiHAqwvGrcO6QHx9e6nfwXOol+hz3ySgeQRQlkG+q0+wFag9+QIDAQABMA0GCSqGSIb3DQEBCwUAA4IBAQAWyPLC7/J1kYg8AQxpUyLOvLI8n79s4FOQ+5jOrI/uX8m9f+Hf8Vv14GK0C281opGfqu2GC+PjHsPaY7ILHOO7NnSkF1rfkAyMqO5cgt/QCICb3W7C4Px6jzbk0AD6v8wv2EFG6yz0Oghxa+ls4cOnVaKQtH79JF0AuRCNxGnKjap1Qs9f4GXNSmKcV02UHkEBYN2Tei2vxbsBNc1+hrvhWkKbTPeM2Pe1WD8tTAVeF2nBM0J160dfX3CQnY8EUc8c5b9fwbFB61aj2Fw1rRf4R5AJnCpo5CaAGtsQUxbMugF2qeoTyyUDYttbPqEoUX07mH1hvedYlYD9hf3sf96e"
                        ],
                      "alg": "RS256",
                      "n": "mf9n9WuaNt51HfjyQwTvkLu8CGTPcJ2mJbbg70VxcbuSdF0KO5n12ht3xeqCditCrUVmTbin-B4W1-sQa_FtjRs-YhzcCUyuQsBuXDfZ_bhA9JurL79_sbplbXCbuG8uN3WIen6woIsqBpl7_Y0Jm4DFQHtBoU3DGunLapjWtawTRDdcWWI75HaQkkxfTzZDa-y14XYhJqz9Er9SaB2wo0XLwB8XuH-s2UfELWuv-iGHvigHvxJmeoGOaCzunwaKgoJXkcU-8thnu4g4dIhcTpz1i5Oc7tEVSwLnhiHAqwvGrcO6QHx9e6nfwXOol-hz3ySgeQRQlkG-q0-wFag9-Q"
                      }
                    ]
                }
        }
    customFields:
      type: object
      description: Contains custom field information.
      properties:
        path:
          type: string
          example: custom_field_path
          description: |
            The path appended to the endpoint to gain access to the custom field.

            **Note**: The `path` must be in `snake_case`.
        scope:
          type: array
          description: All scopes granted to the custom field.
          items:
            type: string
        name:
          type: string
          example: custom_field_name
          description: The name of the custom field.
        data_type:
          type: string
          example: string
          enum:
            - string
            - integer
            - decimal
            - date
            - select
            - checkbox
            - tags
            - phone
            - email
          description: The data type for the custom field.
        id:
          type: string
          example: new_custom_field
          description: The unique ID for the custom field schema.
    Consent:
      type: object
      description: Contains important consent information.
      properties:
        key:
          type: string
          pattern: '[a-z][a-z0-9]*(_[a-z][a-z0-9]*)*'
          description: The unique consent identifier in `snake_case`.
        tags:
          type: array
          description: String tags used for filtering consents.
          items:
            type: string
        consent_type:
          type: string
          description: The consent type.
          enum:
          - opt-in
          - opt-out
        reporter:
          type: string
          description: Specifies the reporter. This is the person or group who modified the consent on behalf of the user.
        versions:
          type: array
          description: The consent versions. Versions are sorted in descending order of version ID.
          items:
            $ref: '#/components/schemas/ConsentVersions'
        status:
          type: string
          description: |
            The consent status.

            A consent can be `active` or `archived`. By default, a consent is active. An archived consent cannot be updated and cannot be granted by an end-user. An archived consent can be reactivated.
          enum:
          - active
          - archived
        associated_consents:
          type: array
          description: |
            The standalone consents that are associated with the consent group.

            **Note**: The `associated_consents` array is required for consent groups only.
          items:
            type: string
      required:
        - key
        - consent_type
        - status
    NewConsent:
      type: object
      description: Payload to create a new consent
      properties:
        key:
          type: string
          pattern: '[a-z][a-z0-9]*(_[a-z][a-z0-9]*)*'
          description: The unique consent identifier in `snake_case`.
        tags:
          type: array
          description: |
            String tags used for filtering consents. Though required, you can pass an empty array.
          items:
            type: string
        status:
          type: string
          description: |
            The consent status.

            > **Note**: A consent can be `active` or `archived`. By default, a consent is active. An archived consent cannot be updated and cannot be granted by an end-user. An archived consent can be reactivated.
          enum:
          - active
          - archived
        consent_type:
          type: string
          description: The consent type.
          enum:
          - opt-in
          - opt-out
        # reporter:
        #   type: string
        #   description: Specifies the reporter. This is the person or group who modified the consent on behalf of the user.
        translations:
          type: object
          description: |
            Consent translations of the first version. This field **cannot** be empty.

            > **Tip**: For more information on available languages, please see [the docs page](https://developer.reachfive.com/help/languages.html).
          properties:
            locale:
              type: object
              description: The locale `key` denotes the language such as `fr` and contains the translation map.
              properties:
                title:
                  type: string
                  description: The title of the consent translation. This is what the user reads when they decide to opt-in or opt-out.
                description:
                  type: string
                  description: |
                    The localized consent description in Markdown format.
                    **Note**: Line feed and carriage returns are converted to `\n`.
            # fr:
            #   type: object
            #   description: The locale `key` denotes the language such as `fr` and contains the translation map.
            #   properties:
            #     title:
            #       type: string
            #       description: The title of the consent translation. This is what the user reads when they decide to opt-in or opt-out.
            #       example: "Newsletter billeterie"
            #     description:
            #       type: string
            #       description: |
            #         The localized consent description in Markdown format.

            #         > **Note**: Line feed and carriage returns are converted to `\n`.
            #       example: "La newsletter billeterie (date d'ouvertures des ventes matchs, offres exclusives)."
        associated_consents:
          type: array
          description: |
            The standalone consents that are associated with the consent group.

            **Note**: The `associated_consents` array is required for consent groups only.
          items:
            type: string
      required:
        - key
        - consent_type
        - translations
        - tags
    ConsentStatus:
      type: object
      description: The status of the description.
      properties:
        status:
          type: string
          enum:
          - 'archived'
          - 'active'
          description: The status of the consent.
    EditableConsent:
      type: object
      description: Payload to update a consent
      properties:
        tags:
          type: array
          description: String tags used for filtering consents.
          items:
            type: string
        versions:
          type: array
          description: The consent versions. This field **cannot** be empty.
          items:
            $ref: '#/components/schemas/EditableConsentVersions'
      required:
        - versions
        - tags
    ConsentVersions:
      type: object
      properties:
        version_id:
          type: integer
          description: The version's ID.
        author_name:
          type: string
          description: The name of the user who created or last updated the version.
        translations:
          type: object
          description: |
            Consent translations. This field **cannot** be empty.

            > **Tip**: For more information on available languages, please see [the docs page](https://developer.reachfive.com/help/languages.html).
          properties:
            locale:
              type: object
              description: The locale `key` denotes the language such as `fr` and contains the translation map.
              properties:
                title:
                  type: string
                  description: The title of the consent translation. This is what the user reads when they decide to opt-in or opt-out.
                description:
                  type: string
                  description: |
                    The localized consent description in Markdown format.
                    **Note**: Line feed and carriage returns are converted to `\n`.
    EditableConsentVersions:
      type: object
      properties:
        version_id:
          type: integer
          description: The version's ID.
        translations:
          type: object
          description: |
            Consent translations. This field **cannot** be empty.

            > **Tip**: For more information on available languages, please see [the docs page](https://developer.reachfive.com/help/languages.html).
          properties:
            locale:
              type: object
              description: The locale `key` denotes the language such as `fr` and contains the translation map.
              properties:
                title:
                  type: string
                  description: The title of the consent translation. This is what the user reads when they decide to opt-in or opt-out.
                description:
                  type: string
                  description: |
                    The localized consent description in Markdown format.
                    **Note**: Line feed and carriage returns are converted to `\n`.
    UserConsentType:
      type: object
      properties:
        count:
          type: integer
        key:
          type: string
          enum:
          - 'granted'
          - 'refused'
          - 'missing'
  parameters:
    IpAddress:
      name: IpAddress
      in: path
      description: The IP address.
      schema:
        type: string
      example: "2001:db8:3333:4444:5555:6666:7777:8888"
    include_all_logs:
      name: include_all_logs
      in: query
      description: Boolean that specifies whether to include all job logs or just error and warning logs.
      schema:
        type: boolean
      example: true
    format:
      name: format
      in: query
      description: |
        Specifies the format of the export. This is either `JSON` or `CSV`.

        Defaults to CSV when not specified.
      schema:
        type: enum
      example: JSON
    phone_number:
      name: phone_number
      in: query
      description: The user's phone number.
      schema:
        type: string
      example: "+353871234445"
    country_code:
      name: country_code
      in: query
      description: The country code.
      schema:
        type: string
      example: "FR"
    keepInLiteProfile:
      name: keepInLiteProfile
      in: query
      description: A boolean where you can keep the lite profile information for a user.
      schema:
        type: boolean
      example: true
    customField:
      name: custom_field
      in: path
      required: true 
      description: The path to the custom field. This is in `snake_case`.
      example: custom_field
      schema:
        type: string
    clientId:
      name: clientId
      in: path
      required: true 
      description: The ReachFive Client ID.
      schema:
        type: integer
    clientIdQuery:
      name: clientId
      in: query
      description: |
        The ReachFive Identity Client ID.

        > **Note**: This is required if using with login as dynamic mode. Otherwise, it is optional.
      schema:
        type: integer
    responseType:
      name: responseType
      in: query
      description: |
        The response type. This could be `token` or `code`.

        > **Note**: This is required if using with login as dynamic mode. Otherwise, it is optional.
      schema:
        type: string
    redirectUrl:
      name: redirectUrl
      in: query
      description: |
        The URL to which the user is redirected.

        > **Note**: Typically, this means the redirect URL must be whitelisted in your ReachFive settings.
        >
        > **Note**: This is required if using with login as dynamic mode. Otherwise, it is optional.
      schema:
        type: string
    kid:
      name: kid
      in: path
      required: true
      description: The ID of the JWK Set.
      schema:
        type: integer
    Authorization:
      name: Authorization
      in: header
      schema:
        type: string
      required: true
      description: Bearer `{token}` for a valid OAuth token.
    userId:
      name: userId
      in: path
      description: ReachFive user ID.
      required: true
      schema:
        type: string
        pattern: '[a-zA-Z0-9-_]{20}'
      example: AW-A9V7UHw00VwEdbXNI
    addressId:
      name: addressId
      in: path
      description: Address ID.
      required: true
      schema:
        type: integer
      example: 1
    email:
      name: email
      in: path
      description: The user's email address.
      required: true
      schema:
        type: string
        format: email_address@site.url
      example: nikkyd@email.com
    queryClientfields:
      name: fields
      in: query
      description: |
        Fields to retrieve in the response.
      schema:
        type: array
        items:
          type: string
      explode: false
      example: [name,scope,token_liftime_in_seconds] # https://github.com/Redocly/redoc/issues/1010
      allowReserved: true # https://github.com/Redocly/redoc/issues/1010
    fields:
      name: fields
      required: true
      in: query
      description: |
        Fields to retrieve in the response.
        
        **Note**: See the [user profile object](https://developer.reachfive.com/docs/models-user-profile.html#the-user-profile-object) for a full list of fields to query.
      schema:
        type: array
        items:
          type: string
      explode: false
      example: [name,email,gender,emails.unverified] # https://github.com/Redocly/redoc/issues/1010
      allowReserved: true # https://github.com/Redocly/redoc/issues/1010
    eventFields:
      name: fields
      in: query
      description: |
        Fields to retrieve in the response.
        
        **Note**: See the [user event object](https://developer.reachfive.com/docs/models-user-events.html) for a full list of fields to query.
      schema:
        type: array
        items:
          type: string
      explode: false
      example: [id,user_id,device,auth_type,client_id] # https://github.com/Redocly/redoc/issues/1010
      allowReserved: true # https://github.com/Redocly/redoc/issues/1010
    consent_fields:
      name: fields
      in: query
      description: Fields to retrieve in the response for the consents API. Specifying a field retrieves **only** that field in the response.
      schema:
        type: array
        items:
          type: string
      explode: false
      example: [key,consent_type,versions,tags,status]
      allowReserved: true
    extendedFields:
      name: extendedFields
      in: query
      description: |
        Query the user's extended fields such as `custom_fields`. These are the fields outside those of the default User Profile Object. When using 
        this query parameter, the response will contain these extended fields in addition to the standard fields.

        **Note**: See our [custom fields guide](https://developer.reachfive.com/docs/custom-fields.html#create-custom-fields) for more details.
      schema:
        type: array
        items:
          type: string
      example: [custom_fields]
    filter:
      name: filter
      in: query
      description: Filter data. See [Filtering](#section/Filtering) for more details.
      schema:
        type: string
    page:
      name: page
      in: query
      description: Specifies the page number for the search.
      schema:
        type: integer
        example: 2
        default: 1
    count:
      name: count
      in: query
      description: The number of items per page.
      schema:
        type: integer
        example: 10
        default: 10
        maximum: 1000
    countCompromised:
      name: count
      in: query
      description: The number of items per page.
      schema:
        type: integer
        example: 20
        default: 14
        maximum: 1000
    job_definition_id:
      name: job_definition_id
      in: path
      required: true
      schema:
        type: string
        example: AXFCFSusqbZzXmWk_Qkw
      description: The ID of the desired job definition.
    job_id:
      name: job_id
      in: path
      required: true
      schema:
        type: string
        example: AXV2riQvTLnGpQjh-n5e
      description: The ID of the specific job that was run.
    sort:
      name: sort
      in: query
      description: |
        Sorting parameter.

        Use `field:order` where order is `asc` for ascending and `desc` for descending.
      schema:
        type: string
        example: 'date:desc' # https://github.com/Redocly/redoc/issues/1010
      allowReserved: true # https://github.com/Redocly/redoc/issues/1010
    key:
      name: key
      in: path
      required: true
      description: The unique consent identifier in `snake_case`.
      schema:
        type: string
        pattern: '[a-z][a-z0-9]*(_[a-z][a-z0-9]*)*'
        example: billeterie
  securitySchemes:
    OpenID:
      type: openIdConnect
      openIdConnectUrl: https://YOUR_DOMAIN/.well-known/openid-configuration
    OAuth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: /oauth/authorize
          tokenUrl: /oauth/token
          refreshUrl: /oauth/token # optional
          scopes:
            none: No particular scope is required
            export:facebook-likes: export:facebook-likes
            export:users: export:users
            import:users: import:users
            manage:consents: manage:consents
            manage:users: manage:users
            manage:clients: manage:clients
            manage:settings: manage:settings
            read:consents: read:consents
            read:facebook-likes: read:facebook-likes
            read:clients: read:clients
            read:segments: read:segments
            read:user-events: read:user-events
            read:users: read:users
            read:jobs: read:jobs
            manage:jobs: manage:jobs
            execute:jobs: execute:jobs
        implicit:
          authorizationUrl: /oauth/authorize
          scopes:
            none: No particular scope is required
            export:facebook-likes: export:facebook-likes
            export:users: export:users
            import:users: import:users
            manage:consents: manage:consents
            manage:users: manage:users
            manage:mfa: manage:mfa
            read:mfa: read:mfa
            manage:clients: manage:clients
            read:consents: read:consents
            read:facebook-likes: read:facebook-likes
            read:clients: read:clients
            read:segments: read:segments
            read:user-events: read:user-events
            read:users: read:users
            read:jobs: read:jobs
            manage:jobs: manage:jobs
            execute:jobs: execute:jobs
