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

# Generate authenticated URL

> Generates an authenticated webshop URL for a player that signs them in when opened. target selects the page it opens: DEFAULT or ROOT for the webshop's root page, HOME for the home page, STORE for the store page, LOYALTY for the loyalty club page, or DAILY_STREAK for the daily streak page. Authenticate the request with an HMAC signature of the request body, or with the deprecated API key. This is a server-side endpoint and must not be called from the game client.



## OpenAPI

````yaml /ingress-openapi.json post /sdk/server/generate_url
openapi: 3.0.0
info:
  title: Stash API
  description: >-
    Set of APIs for integrating Stash functionality into games. API set includes
    authentication, payment processing, checkout links, user management, and
    various platform-specific integrations. The API supports both client-side
    and server-side implementations with appropriate security measures for each
    context.
  version: '1.0'
servers:
  - url: https://test-api.stash.gg
security: []
tags:
  - name: Catalog
    description: >-
      Server-side catalog endpoints for shops with a real-time catalog
      integration.
  - name: Launcher Payment
    description: Payment processing endpoints for Stash Launcher.
  - name: Subscription Checkout Links
    description: Checkout link generation for subscription purchases
  - name: Webshop Account Linking
    description: >-
      Authentication endpoints for integrating third-party login providers or
      custom login with Stash Webshops.
  - name: Payments
    description: Payment history and transaction management endpoints
  - name: Pricing
    description: Server-side pricing endpoints for fetching uploaded price sheet data
  - name: Stash Pay
    description: Server-side quick payment endpoints for internal use
  - name: Web Shop
    description: Server-side endpoints that control your web shop.
  - name: Subscription Plans
    description: Retrieve subscription plan details and pricing
  - name: Subscriptions
    description: Manage player subscriptions - retrieve, cancel, and reactivate
  - name: Server URLs
    description: Server-side URL generation endpoints for authenticated URLs
  - name: User Preferences
    description: User preferences management endpoints for payment channel preferences
  - name: Loyalty
    description: >-
      Endpoints for reading a shop's loyalty program and, for enabled shops,
      configuring it
  - name: Localization
    description: >-
      Endpoints for refreshing a shop's localizations from its localization
      source
  - name: Reports
    description: >-
      Endpoints for listing a shop's daily transaction files and downloading
      them through signed links
paths:
  /sdk/server/generate_url:
    post:
      tags:
        - Server URLs
      summary: Generate authenticated URL
      description: >-
        Generates an authenticated webshop URL for a player that signs them in
        when opened. target selects the page it opens: DEFAULT or ROOT for the
        webshop's root page, HOME for the home page, STORE for the store page,
        LOYALTY for the loyalty club page, or DAILY_STREAK for the daily streak
        page. Authenticate the request with an HMAC signature of the request
        body, or with the deprecated API key. This is a server-side endpoint and
        must not be called from the game client.
      operationId: GenerateAuthenticatedUrl
      requestBody:
        content:
          application/json:
            schema:
              $ref: >-
                #/components/schemas/pie.sdk.urls.GenerateAuthenticatedUrlRequest
        required: true
      responses:
        '200':
          description: A successful response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/pie.sdk.urls.GenerateUrlResponse'
        default:
          description: An unexpected error response.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/google.rpc.Status'
      security:
        - hmac: []
        - deprecatedApiKey: []
components:
  schemas:
    pie.sdk.urls.GenerateAuthenticatedUrlRequest:
      type: object
      properties:
        user:
          $ref: '#/components/schemas/pie.sdk.urls.User'
        target:
          $ref: >-
            #/components/schemas/pie.sdk.urls.GenerateAuthenticatedUrlRequest.Target
    pie.sdk.urls.GenerateUrlResponse:
      type: object
      properties:
        url:
          type: string
          description: Generated URL for the requested target
        decline:
          $ref: '#/components/schemas/pie.sdk.login_decline.LoginDecline'
    google.rpc.Status:
      type: object
      properties:
        code:
          type: integer
          format: int32
        message:
          type: string
        details:
          type: array
          items:
            $ref: '#/components/schemas/google.protobuf.Any'
    pie.sdk.urls.User:
      type: object
      properties:
        id:
          type: string
          description: User ID from the game/application
        email:
          type: string
          description: Optional email address
        profileImageUrl:
          type: string
          description: Optional profile image URL
        displayName:
          type: string
          description: Optional display name
        regionCode:
          type: string
          description: >-
            Recommended. The player's region as an ISO 3166-1 country code, for
            example `BR` (a 3-letter code is also accepted). Stash saves it for
            the player when it generates the URL and sets the player's currency
            from it (the primary currency of that region). A later authenticated
            URL or login approval that sends a region replaces it. Must be a
            country code; anything else (for example the area code `419`) fails
            the request with `invalid region code`.
        platform:
          $ref: '#/components/schemas/pie.sdk.urls.User.Platform'
        language:
          type: string
          description: >-
            Optional. The player's preferred language as an ISO 639-1 code, for
            example `en` or `pt`. The country goes in `region_code`, and Stash
            builds the locale from the two. Stash saves it for the player, and
            the most recent value it receives applies. A value that is not a
            language code, such as `pt-BR`, is ignored.
        currency:
          type: string
          description: >-
            Optional. The player's preferred currency as an ISO 4217 code, for
            example `EUR`. Overrides the currency Stash sets from the region
            when the shop prices its items in it. Stash saves it for the player,
            and the most recent value it receives applies. An invalid value is
            ignored.
        clientVersion:
          type: string
          description: >-
            Optional. The version of the app the player is using, for example
            `2.14.0`. When the shop has a minimum app version for the player's
            `platform` (or a shop-wide one) and this version is below it, the
            link is not issued: the response carries `decline` and `url` is
            empty.
        gameVersion:
          type: string
          description: >-
            Optional. The version of the game content the player is using.
            Informational.
    pie.sdk.urls.GenerateAuthenticatedUrlRequest.Target:
      type: string
      enum:
        - DEFAULT
        - HOME
        - LOYALTY
        - ROOT
        - STORE
        - DAILY_STREAK
      default: DEFAULT
    pie.sdk.login_decline.LoginDecline:
      type: object
      properties:
        reason:
          $ref: '#/components/schemas/pie.sdk.login_decline.LoginDeclineReason'
        minAppVersion:
          type: string
          description: >-
            The minimum app version the shop requires for the player's platform.
            Set only when `reason` is `CLIENT_OUTDATED`.
      description: >-
        A declined login. A call that declines returns it in a successful
        response,

        in place of its usual result.
    google.protobuf.Any:
      type: object
      properties:
        '@type':
          type: string
      additionalProperties: {}
    pie.sdk.urls.User.Platform:
      type: string
      enum:
        - UNDEFINED
        - IOS
        - ANDROID
      default: UNDEFINED
    pie.sdk.login_decline.LoginDeclineReason:
      type: string
      enum:
        - LOGIN_DECLINE_REASON_UNSPECIFIED
        - NOT_ELIGIBLE
        - NOT_IN_ROLLOUT
        - CLIENT_OUTDATED
        - OTHER
      default: LOGIN_DECLINE_REASON_UNSPECIFIED
      description: >-
        - LOGIN_DECLINE_REASON_UNSPECIFIED: Not a valid reason; a request that
        sends it is rejected
         - NOT_ELIGIBLE: The store is not available to this player yet
         - NOT_IN_ROLLOUT: The store is not enabled for this player in the current rollout
         - CLIENT_OUTDATED: The player's app is older than the minimum version the shop requires, and the player needs to update it
         - OTHER: Any other reason
      title: >-
        Why a web shop login was declined. Shared by every call that can decline
        a

        login
  securitySchemes:
    hmac:
      type: apiKey
      description: >-
        Versioned HMAC-SHA256 signature authenticating server-to-server SDK
        requests (your backend calling Stash), as opposed to client-side SDK
        operations. Recommended over the deprecated X-Stash-Api-Key for the best
        security. Header format:
        v1;{appId};{unixMillisTimestamp};{base64Signature}
        (semicolon-delimited). {base64Signature} is the base64-encoded
        HMAC-SHA256 of the string {unixMillisTimestamp}.{requestBody} using your
        app ingress secret (the ingress secret is shown base64-encoded in
        Studio; base64-decode it to the raw bytes used as the HMAC key), where
        {requestBody} is the request body exactly as you send it for POST and
        PUT requests (the compact canonical request JSON is also accepted) and
        empty for GET requests. A signature over the exact bytes verifies for
        bodies of up to 18 KiB (18,432 bytes); a larger body may be refused with
        401 even when correctly signed. The timestamp must be within 5 minutes
        of Stash server time. Your appId is your immutable app identifier, shown
        in Stash Studio under Project Settings > App details; your ingress
        secret is under Project Settings > API Secrets.
      name: x-stash-hmac-signature
      in: header
    deprecatedApiKey:
      type: apiKey
      description: >-
        DEPRECATED: API key authentication (X-Stash-Api-Key) is not supported
        for shops or API keys created on or after 2026-08-15; those must use
        HMAC authentication via the x-stash-hmac-signature header. Shops and
        keys created before the cutoff may continue using their X-Stash-Api-Key
        for server-to-server operations, but are encouraged to migrate to HMAC
        as soon as possible for the best security.
      name: X-Stash-Api-Key
      in: header

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.