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

# Retrieve a User

> Endpoint that allows the retrieval of a visitor based on a known User ID. This endpoint can only recover visitors with user IDs, so please ensure your Sprig implementation has user tracking configured correctly based on your SDK installation: /docs/Installation/introduction-web/index This endpoint will retrieve visitor info, a list of attributes tied to the visitor, and a list of events with relevant filter criteria.



## OpenAPI

````yaml reference/sprig-api.json GET /v2/users/{userId}
openapi: 3.1.0
info:
  contact:
    email: support@sprig.com
    name: Support
  description: >-
    Sprig is a continuous product research tool that helps you automatically
    capture the user insights you need to consistently improve your product,
    user experience, marketing, and more.


    While traditional studies are slow, difficult to target, and lack context,
    Sprig studies are delivered automatically to specific users at specific
    moments throughout the customer journey — all within the product experience.


    This API provides tools to manage users and studies. User management is used
    if you are segmenting your samples between visitors that will be tracked
    with an ID and unregistered visitors. Study export tools will allow you to
    take results data and send it to another data store or format results for
    presentation in other applications
  title: Sprig API
  version: 2.2.1
servers:
  - url: https://api.sprig.com
security: []
tags:
  - description: Operations allowing export of survey data
    name: V1
  - description: Operations allowing export of survey data
    name: V1
  - description: All operations pertaining to the user object
    name: users
  - description: All operations pertaining to the user events
    name: events
  - description: Operations allowing export of survey data
    name: V1
paths:
  /v2/users/{userId}:
    parameters:
      - description: Id of an existing user.
        in: path
        name: userId
        required: true
        schema:
          type: string
    get:
      tags:
        - V2
      summary: Retrieve a User
      description: >-
        Endpoint that allows the retrieval of a visitor based on a known User
        ID.

        This endpoint can only recover visitors with user IDs, so please ensure
        your Sprig implementation has user tracking configured correctly based
        on your SDK installation: /docs/Installation/introduction-web/index

        This endpoint will retrieve visitor info, a list of attributes tied to
        the visitor, and a list of events with relevant filter criteria.
      operationId: get-v2-users-:userId
      parameters:
        - $ref: '#/components/parameters/Authorization-API-Key'
      responses:
        '200':
          content:
            application/json:
              examples: {}
              schema:
                $ref: '#/components/schemas/Userv2'
          description: OK
        '404':
          $ref: '#/components/responses/404'
        '500':
          $ref: '#/components/responses/500'
components:
  parameters:
    Authorization-API-Key:
      description: API-Key YOUR_API_KEY
      in: header
      name: Authorization
      required: true
      schema:
        type: string
  schemas:
    Userv2:
      description: API V2 user model
      properties:
        attributes:
          type: object
        createdAt:
          type: number
        events:
          items:
            properties:
              count:
                type: number
              createdAt:
                type: number
              event:
                minLength: 1
                type: string
              updatedAt:
                type: number
            type: object
          minItems: 1
          type: array
          uniqueItems: true
        externalUserId:
          minLength: 1
          nullable: true
          type: string
        id:
          minLength: 1
          type: string
      title: ''
      type: object
      x-examples:
        V2 User:
          attributes:
            completed_flow: false
            plan: enterprise
          createdAt: 1612739790947
          events:
            - count: 1
              createdAt: 1612739790947
              event: Clicked Signup
              updatedAt: 1612739912314
          id: a926111b-fa62-49f7-8666-2c94ca8b18fc
  responses:
    '404':
      description: Not Found
    '500':
      description: Something went wrong on Sprig's side. These are very rare :)

````