# Get profile

> Retrieves the details of an existing end user of your app.

## OpenAPI

```yaml
/api-specs/adapty-api.yaml get /api/v2/server-side-api/profile/
openapi: 3.1.0
info:
  title: Adapty server-side API
  version: 1.0.0
servers:
  - url: https://api.adapty.io
    description: Production server
paths:
  /api/v2/server-side-api/profile/:
    get:
      summary: Get profile
      description: Retrieves the details of an existing end user of your app.
      operationId: getProfile
      tags:
        - Profile
      security:
        - apikeyAuth: []
      parameters:
        - name: adapty-customer-user-id
          in: header
          required: false
          schema:
            type: string
          description: The unique ID of the customer in your system. Either `adapty-customer-user-id` or `adapty-profile-id` is required.
        - name: adapty-profile-id
          in: header
          required: false
          schema:
            type: string
          description: The unique ID of the profile in your system. Your best option if you are working with anonymous profiles. Either `adapty-customer-user-id` or `adapty-profile-id` is required.
      responses:
        "200":
          description: Profile retrieved successfully
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ProfileResponse"
              example:
                data:
                  app_id: 14c3d333-2f3a-455a-aa86-ef83dff6913b
                  profile_id: d8533a10-bcce-4e33-8c9d-88b05ac56559
                  customer_user_id: 77B14FB4-FD2A-4D38-AA3A-4C433F79863C
                  total_revenue_usd: 9.99
                  segment_hash: fdaeef7f8aaa33c9
                  timestamp: 1733324566777
                  custom_attributes:
                    - key: favourite_sport
                      value: yoga
                  access_levels:
                    - access_level_id: premium
                      store: app_store
                      store_product_id: unlimited.9999
                      store_base_plan_id: null
                      store_transaction_id: "2000000335013007"
                      store_original_transaction_id: "2000000335013007"
                      offer: null
                      starts_at: null
                      purchased_at: "2024-12-24T10:50:23+00:00"
                      originally_purchased_at: "2024-12-24T10:50:23+00:00"
                      expires_at: null
                      renewal_cancelled_at: "2025-01-05T13:27:47.461425+00:00"
                      billing_issue_detected_at: null
                      is_in_grace_period: false
                      cancellation_reason: null
                  subscriptions:
                    - store: app_store
                      store_product_id: unlimited.9999
                      store_base_plan_id: null
                      store_transaction_id: "2000000815013007"
                      store_original_transaction_id: "2000000815013007"
                      offer: null
                      environment: Sandbox
                      purchased_at: "2024-12-24T10:50:23+00:00"
                      originally_purchased_at: "2024-12-24T10:50:23+00:00"
                      expires_at: null
                      renewal_cancelled_at: null
                      billing_issue_detected_at: null
                      is_in_grace_period: false
                      cancellation_reason: null
                  non_subscriptions:
                    - purchase_id: 7a5f9a7d-e236-33e6-96d8-53a3c59c5562
                      store: app_store
                      store_product_id: 1year.premium
                      store_base_plan_id: null
                      store_transaction_id: "30002109551456"
                      store_original_transaction_id: "30002109551456"
                      purchased_at: "2022-10-12T09:42:50+00:00"
                      environment: Production
                      is_refund: false
                      is_consumable: false
        "401":
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
              example:
                errors:
                  - source: non_field_errors
                    errors:
                      - Authentication credentials were not provided.
                error_code: not_authenticated
                status_code: 401
        "404":
          description: Profile not found
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ErrorResponse"
              example:
                errors:
                  - source: null
                    errors:
                      - Profile not found
                error_code: profile_does_not_exist
                status_code: 404
        "500":
          description: Internal server error
components:
  schemas:
    ProfileResponse:
      type: object
      properties:
        data:
          $ref: "#/components/schemas/Profile"
      required:
        - data
    ErrorResponse:
      type: object
      properties:
        errors:
          type: array
          items:
            type: object
            properties:
              source:
                type: string
                nullable: true
                description: Source of the error
              errors:
                type: array
                items:
                  type: string
                description: Array of error messages
        error_code:
          type: string
          description: Short error name
        status_code:
          type: integer
          description: HTTP status code
      required:
        - errors
        - error_code
        - status_code
    Profile:
      type: object
      properties:
        app_id:
          type: string
          format: uuid
          description: The internal ID of your app
        profile_id:
          type: string
          format: uuid
          description: Adapty profile ID
        customer_user_id:
          type: string
          nullable: true
          description: The ID of your user in your system
        total_revenue_usd:
          type: number
          format: float
          description: A float value representing the total revenue in USD earned in the profile
        segment_hash:
          type: string
          description: Internal parameter
        timestamp:
          type: integer
          format: int64
          description: Response time in milliseconds, needs for resolve a race condition
        custom_attributes:
          type: array
          items:
            $ref: "#/components/schemas/CustomAttribute"
          description: A maximum of 30 custom attributes to the profile are allowed to be set
        access_levels:
          type: array
          items:
            $ref: "#/components/schemas/AccessLevel"
          description: Array of Access level objects. Empty array if the customer has no access levels
        subscriptions:
          type: array
          items:
            $ref: "#/components/schemas/Subscription"
          description: Array of Subscription objects. Empty array if the customer has no subscriptions
        non_subscriptions:
          type: array
          items:
            $ref: "#/components/schemas/NonSubscription"
          description: Array of Non-Subscription objects. Empty array if the customer has no purchases
      required:
        - app_id
        - profile_id
        - customer_user_id
        - total_revenue_usd
        - segment_hash
        - timestamp
        - custom_attributes
        - access_levels
        - subscriptions
        - non_subscriptions
    CustomAttribute:
      type: object
      properties:
        key:
          type: string
          maxLength: 30
          description: The key must be a string with no more than 30 characters. Only letters, numbers, dashes, points, and underscores allowed
        value:
          oneOf:
            - type: string
            - type: number
          description: The attribute value must be no more than 50 characters. Only strings and floats are allowed as values
      required:
        - key
        - value
    AccessLevel:
      type: object
      properties:
        access_level_id:
          type: string
          description: Access level identifier
        store:
          type: string
          description: Store where the access level was purchased
        store_product_id:
          type: string
          description: Product ID in the store
        store_base_plan_id:
          type: string
          nullable: true
          description: Base plan ID in the store
        store_transaction_id:
          type: string
          description: Transaction ID in the store
        store_original_transaction_id:
          type: string
          description: Original transaction ID in the store
        offer:
          allOf:
            - $ref: "#/components/schemas/OfferDTO"
          nullable: true
          description: Offer details, if a promotional or introductory offer was applied
        starts_at:
          type: string
          format: date-time
          nullable: true
          description: When the access level starts
        purchased_at:
          type: string
          format: date-time
          description: When the access level was purchased
        originally_purchased_at:
          type: string
          format: date-time
          description: When the access level was originally purchased
        expires_at:
          type: string
          format: date-time
          nullable: true
          description: When the access level expires
        renewal_cancelled_at:
          type: string
          format: date-time
          nullable: true
          description: When renewal was cancelled
        billing_issue_detected_at:
          type: string
          format: date-time
          nullable: true
          description: When billing issue was detected
        is_in_grace_period:
          type: boolean
          description: Whether the access level is in grace period
        cancellation_reason:
          type: string
          nullable: true
          description: Reason for cancellation
    Subscription:
      type: object
      properties:
        store:
          type: string
          description: Store where the subscription was purchased
        store_product_id:
          type: string
          description: Product ID in the store
        store_base_plan_id:
          type: string
          nullable: true
          description: Base plan ID in the store
        store_transaction_id:
          type: string
          description: Transaction ID in the store
        store_original_transaction_id:
          type: string
          description: Original transaction ID in the store
        offer:
          allOf:
            - $ref: "#/components/schemas/OfferDTO"
          nullable: true
          description: Offer details, if a promotional or introductory offer was applied
        environment:
          type: string
          description: Environment (Sandbox, Production)
        purchased_at:
          type: string
          format: date-time
          description: When the subscription was purchased
        originally_purchased_at:
          type: string
          format: date-time
          description: When the subscription was originally purchased
        expires_at:
          type: string
          format: date-time
          nullable: true
          description: When the subscription expires
        renewal_cancelled_at:
          type: string
          format: date-time
          nullable: true
          description: When renewal was cancelled
        billing_issue_detected_at:
          type: string
          format: date-time
          nullable: true
          description: When billing issue was detected
        is_in_grace_period:
          type: boolean
          description: Whether the subscription is in grace period
        cancellation_reason:
          type: string
          nullable: true
          description: Reason for cancellation
    NonSubscription:
      type: object
      properties:
        purchase_id:
          type: string
          format: uuid
          description: Unique purchase identifier
        store:
          type: string
          description: Store where the purchase was made
        store_product_id:
          type: string
          description: Product ID in the store
        store_base_plan_id:
          type: string
          nullable: true
          description: Base plan ID in the store
        store_transaction_id:
          type: string
          description: Transaction ID in the store
        store_original_transaction_id:
          type: string
          description: Original transaction ID in the store
        purchased_at:
          type: string
          format: date-time
          description: When the purchase was made
        environment:
          type: string
          description: Environment (Sandbox, Production)
        is_refund:
          type: boolean
          description: Whether this is a refund
        is_consumable:
          type: boolean
          description: Whether this is a consumable purchase
    OfferDTO:
      type: object
      properties:
        category:
          type: string
          enum:
            - introductory
            - promotional
            - offer_code
            - win_back
          description: Offer category
        type:
          type: string
          enum:
            - free_trial
            - pay_as_you_go
            - pay_up_front
          description: Offer type
        id:
          type: string
          nullable: true
          description: Offer ID
      required:
        - category
        - type
  securitySchemes:
    apikeyAuth:
      type: apiKey
      name: Authorization
      in: header
      default: Api-Key {Your secret API key}
      description: |
        API requests must be authenticated by your secret API key as the **Authorization** 
        header with the value `Api-Key {your_secret_api_key}`, for example, 
        `Api-Key secret_live_...`. Find this key in the Adapty Dashboard -> 
        **App Settings** -> **General** tab -> **API keys** section.
```
