> ## Documentation Index
> Fetch the complete documentation index at: https://moengage-sdk-docs.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Get User

> This API facilitates the retrieval of information of users by specifying the user ids.

### Rate Limit

The rate limit is 20 users per payload and 1000 users per minute.

**Postman Collections**

We have made it easy for you to test the APIs. Click [here](https://www.postman.com/moengage-dev/api-docs/collection/fdgezz6/moengage-get-user-api) to view it in Postman.

### FAQs

* **How do I know which users are available to export and which users are not available in MoEngage to export?**

All available users will be found in the `users` key, and users not available will be found in the `users_not_found` key. Please refer to the sample response in this doc.

* **What if I want to get all the user data available based on the user ids without specifying the fields?**

If the `user_fields_to_export` is not passed, then all the custom attributes and exportable standard attributes will be passed. For specific fields, `user_fields_to_export` needs to be passed along with the required fields.


## OpenAPI

````yaml /api/data/data.yaml post /customers/export
openapi: 3.0.3
info:
  title: MoEngage Data APIs
  version: '1.0'
  description: >-
    This is a comprehensive OpenAPI specification for MoEngage's Data APIs,
    including User, Event, and Device management.

    It's designed to power an interactive API playground on your new
    documentation site.
servers:
  - url: https://api-0{dc}.moengage.com/v1
    description: MoEngage Core API Server
    variables:
      dc:
        default: '1'
        description: >-
          The ‘dc’ in the API Endpoint URL refers to the MoEngage Data Center
          (DC). MoEngage hosts each customer in a different DC. You can find
          your DC number and replace the value of ‘dc’ in the URL by referring
          to the DC and API endpoint mapping
          [here](https://help.moengage.com/hc/en-us/articles/360057030512-Data-Centers-in-MoEngage).
          Your MoEngage Data Center (DC) can be 1, 2, 3, 4,5, 6. 
        enum:
          - '1'
          - '2'
          - '3'
          - '4'
          - '5'
          - '6'
security:
  - Authentication: []
tags:
  - name: User
    description: Operations for creating, updating, retrieving, and managing user profiles.
  - name: Event
    description: Operations for tracking user events.
  - name: Device
    description: Operations for managing user devices.
  - name: Tracking
    description: Endpoints for tracking attribution and installs.
  - name: Utilities
    description: Utility endpoints for testing connections.
  - name: File Imports
    description: Operations for managing asynchronous file imports.
  - name: Bulk
    description: Operations for importing users and events in bulk.
  - name: Webhooks
    description: Incoming webhook specifications from MoEngage.
paths:
  /customers/export:
    post:
      tags:
        - User
      summary: Get User
      description: >-
        This API facilitates the retrieval of information of users by specifying
        the user ids.
      parameters:
        - name: app_id
          in: query
          required: true
          description: >-
            This is the Workspace ID of your MoEngage account that has to be
            passed along with the request. You can find your Workspace ID at
            Settings > Account > APIs > Workspace ID.
          schema:
            type: string
            example: VJ0GSMESHMQA3L7WV1EEK3UR
        - name: X-Forwarded-For
          in: header
          required: false
          description: >-
            The 'X-Forwarded-For' header is used to specify the IP address of
            the client that made the request. This header may be added by proxy
            servers or load balancers. The header value must contain the IP
            address of the original client that initiated the request. Multiple
            IP addresses may be specified in the header value, separated by
            commas.
          schema:
            type: string
            example: 203.0.113.195
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetUserRequest'
      responses:
        '200':
          description: >-
            This response is returned when the request is processed
            successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: >-
                      This field contains the status of the request and
                      specifies whether the request was successful. Supported
                      values are : "success", "failure"
                    example: success
                  type:
                    type: string
                    description: >-
                      This field denotes the fetch type. Supported values are:
                      "export_users".
                    example: export_users
                  data:
                    type: object
                    description: >
                      This field contains the list of users who were not found
                      in MoEngage and returns the data specified for the list of
                      users who were found in MoEngage.


                      This is the structure:

                      ```json

                      {
                          "users_not_found": [
                              {
                                  "identifier_type": "customer_id",
                                  "identifier": "<customer_id>"
                              }
                          ],
                          "users": [
                              {
                                  "user_attributes": {
                                      "<list of user attributes>"
                                  } 
                              }
                          ]
                      }

                      ```
                    properties:
                      users_not_found:
                        type: array
                        description: >-
                          An array of JSON Objects that contains the list of
                          users who were not found in MoEngage.
                        items:
                          $ref: '#/components/schemas/IdentifierObject'
                      users:
                        type: array
                        description: >-
                          Contains the user_attributes specified in the request
                          for each user in specified in the request.
                        items:
                          type: object
                          properties:
                            user_attributes:
                              type: object
                              additionalProperties: true
                              example:
                                last_name: Doe
                                customer_id: john_doe
                                id: 62e79fb15ada55x123g987bu
              examples:
                success_response:
                  summary: Success Response
                  value:
                    status: success
                    type: export_users
                    data:
                      users_not_found:
                        - identifier_type: customer_id
                          identifier: john_doe
                      users:
                        - user_attributes:
                            last_name: Doe
                            customer_id: john_doe
                            name: John
                            custom_user_attr: 12345
                            id: 62e79fb15ada55x123g987bu
        '400':
          description: >-
            This response is returned when the required parameters APP KEY,
            user_id, and so on are missing from the request or when the provided
            params are invalid.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: >-
                      This field contains the status of the request and
                      specifies whether the request was a failure.
                    example: fail
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: >-
                          A descriptive error message explaining why the request
                          failed.
                      type:
                        type: string
                        description: >-
                          The type or category of the error
                          ("MissingAttributeError, Malformed JSON,
                          LimitBreached").
                      request_id:
                        type: string
                        description: >-
                          A unique identifier for the request, useful for
                          debugging.
                      attribute:
                        type: string
                        description: The attribute in the payload that caused the error.
              examples:
                missing_identifiers:
                  summary: Identifiers are missing in the request
                  value:
                    status: fail
                    error:
                      attribute: identifiers
                      message: identifiers is not found in the payload
                      type: MissingAttributeError
                      request_id: UkBwaUmU
                data_missing:
                  summary: Data is missing in the request
                  value:
                    status: fail
                    error:
                      attribute: data
                      message: data is not found in the payload
                      type: MissingAttributeError
                      request_id: DataMiss2
                incorrect_json:
                  summary: JSON is incorrect in the request
                  value:
                    status: fail
                    error:
                      message: >-
                        Could not decode the request body. The JSON was
                        incorrect or not encoded as UTF-8.
                      type: Malformed JSON
                      request_id: NphDCzWk
                limit_exceeded:
                  summary: Users exceeds the allowed limit in the request
                  value:
                    status: fail
                    error:
                      attribute: users
                      message: max limit allowed is 20
                      type: LimitBreached
                      request_id: LimitX4
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: >-
                      This field contains the status of the request and
                      specifies whether the request was a failure.
                    example: fail
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: >-
                          A descriptive error message explaining why the request
                          failed.
                      type:
                        type: string
                        description: >-
                          The type or category of the error (e.g.,
                          Authentication required).
                      request_id:
                        type: string
                        description: >-
                          A unique identifier for the request, useful for
                          debugging.
              examples:
                auth_error:
                  summary: Authorization errors
                  value:
                    status: fail
                    error:
                      message: >-
                        App Secret key mismatch. Please login to the dashboard
                        to verify key
                      type: Authentication required
                      request_id: PVUDFisO
                missing_header:
                  summary: Missing authentication header
                  value:
                    status: fail
                    error:
                      message: Authentication Header Required
                      type: Authentication required
                      request_id: PisPjGQQ
        '403':
          description: >-
            This response is returned when your MoEngage account is suspended or
            blocked.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: >-
                      This field contains the status of the request and
                      specifies whether the request was a failure.
                    example: fail
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: >-
                          A descriptive error message explaining why the request
                          failed.(e.g., Your account is suspended. Please
                          contact MoEngage team.)
                      type:
                        type: string
                        description: >-
                          The type or category of the error (e.g.,
                          BlockedClient, Account Suspended, Account Temporarily
                          Suspended).
                      request_id:
                        type: string
                        description: >-
                          A unique identifier for the request, useful for
                          debugging.
              examples:
                account_blocked:
                  summary: Sample response for when your account is blocked
                  value:
                    status: fail
                    error:
                      message: Your account is suspended. Please contact MoEngage team.
                      type: BlockedClient
                      request_id: ofHUEaEQ
                account_suspended:
                  summary: Sample response for when your account is suspended
                  value:
                    status: fail
                    error:
                      message: Your account is suspended. Please contact MoEngage team.
                      type: Account Suspended
                      request_id: gqJvCNYu
                temp_suspended:
                  summary: >-
                    Sample response for when your account is temporarily
                    suspended
                  value:
                    status: fail
                    error:
                      message: >-
                        Your account is temporarily suspended. Please contact
                        MoEngage team.
                      type: Account Temporarily Suspended
                      request_id: ssSJjoyD
        '413':
          description: This response is returned when the payload size exceeds 128 KB.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: >-
                      This field contains the status of the request and
                      specifies whether the request was a failure.
                    example: fail
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: >-
                          A descriptive error message explaining why the request
                          failed.
                      type:
                        type: string
                        description: >-
                          The type or category of the error (e.g., Payload too
                          large).
                      request_id:
                        type: string
                        description: >-
                          A unique identifier for the request, useful for
                          debugging.
              examples:
                payload_exceeded:
                  summary: Payloads exceeding the size limit
                  value:
                    status: fail
                    error:
                      message: Payload size exceeds 128 KB
                      type: PayloadTooLarge
                      request_id: VFzDwhwt
        '415':
          description: This response is returned when the content type is not supported.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: >-
                      This field contains the status of the request and
                      specifies whether the request was a failure.
                    example: fail
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: >-
                          A descriptive error message explaining why the request
                          failed.
                      type:
                        type: string
                        description: >-
                          The type or category of the error (e.g., Unsupported
                          media type).
                      request_id:
                        type: string
                        description: >-
                          A unique identifier for the request, useful for
                          debugging.
              examples:
                unsupported_media_type:
                  summary: Unsupported media type
                  value:
                    status: fail
                    error:
                      message: Unsupported Media Type
                      type: MediaTypeError
                      request_id: SgBQfKJh
        '429':
          description: >-
            This response is returned when the number of requests has exceeded
            the rate limit.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: >-
                      This field contains the status of the request and
                      specifies whether the request was a failure.
                    example: fail
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: >-
                          A descriptive error message explaining why the request
                          failed.
                      type:
                        type: string
                        description: >-
                          The type or category of the error (e.g., Rate Limits
                          Exceeded).
                      request_id:
                        type: string
                        description: >-
                          A unique identifier for the request, useful for
                          debugging.
              examples:
                rate_limit:
                  summary: Rate limit breach
                  value:
                    status: fail
                    error:
                      message: Rate limit exceeded
                      type: RateLimitError
                      request_id: onqucLYL
        '500':
          description: >-
            This response is returned when the system runs into an unexpected
            error.
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    description: >-
                      This field contains the status of the request and
                      specifies whether the request was a failure.
                    example: fail
                  error:
                    type: object
                    properties:
                      message:
                        type: string
                        description: >-
                          A descriptive error message explaining why the request
                          failed.
                      type:
                        type: string
                        description: >-
                          The type or category of the error (e.g., Server
                          Error).
                      request_id:
                        type: string
                        description: >-
                          A unique identifier for the request, useful for
                          debugging.
              examples:
                unknown_error:
                  summary: Unknown errors
                  value:
                    status: fail
                    error:
                      message: Internal Server Error
                      type: ServerError
                      request_id: KovrwJiF
components:
  schemas:
    GetUserRequest:
      type: object
      properties:
        identifiers:
          type: array
          description: >
            This field is used to specify the identifiers for the users for whom
            the data needs to be fetched.

            Structure:

               ```json
             "identifiers": [
               {
               "identifier_type": "customer_id",
               "identifier": "<customer_id>"
             },
            {

            "identifier_type": "id",

            "identifier": "<MoEngageID>"

            },

            ...{}

            ]

            ```
          items:
            $ref: '#/components/schemas/IdentifierObject'
        user_fields_to_export:
          type: array
          items:
            type: string
          description: >-
            This field is used to specify the fields that need to be fetched for
            the user specified in Identifiers. Tracked standard user attributes
            and custom attributes can be fetched using this API. For the list of
            tracked standard attributes in MoEngage, refer to [User
            Attributes](#user-attributes).
          example:
            - last_name
            - customer_id
            - name
    IdentifierObject:
      type: object
      properties:
        identifier_type:
          type: string
          enum:
            - customer_id
            - id
          description: >-
            This field specifies the identifier type. Identifier types can
            either be customer_id (ID field in the User Profile) or moengage_id
            (the MoEngageID of the user in the User Profile). Allowed values are
            "moengage_id", "customer_id".
          example: customer_id
        identifier:
          type: string
          description: This field specifies the unique identifier that identifies the user.
          example: 6416d1a318r98264512c0f89
  securitySchemes:
    Authentication:
      type: http
      scheme: basic
      description: >
        This authentication parameter, used for access control, must be passed
        along with the request. The API request will be authenticated through
        Basic Authentication. Basic Authentication sends a Base64-encoded string
        containing your username and password with every API request. It encodes
        a 'username:password' string in Base64 and appends the encoded string
        with 'Basic '. This string is included in the authorization header as
        shown below:


        `{"Authorization: Basic Base64_ENCODED_WORKSPACEID_APIKEY=="}`


        The username and password details can be obtained from the MoEngage
        Dashboard. If you're using the API for the first time, follow these
        steps:

        1. Navigate to Settings -> Account -> APIs.

        2. Copy the following details:
           * **Username:** Under Workspace ID (earlier app id), click the copy icon to copy the username.
           * **Password:** In the **API keys** section, click the copy icon in the **Data** tile to copy the API key.

        Use these details to authenticate the API requests.

````