> Agent-readable docs index: /llms.txt. Download /docs.zip to grep all markdown files locally.

---
title: Getting Started
description: Authenticate and make your first Market API request.
icon: rocket
---

# Getting Started

## First Request

<Steps>
  <Step title="Open API settings" icon="settings">
    Open the [market API settings page](https://neverlose.cc/market/api) and copy your `user_id` and secret key.
  </Step>

  <Step title="Choose a method" icon="route">
    Start with `get-balance` for a read-only balance check or `give-for-free` to grant one of your own paid items at no cost to the receiver.
  </Step>

  <Step title="Prepare JSON" icon="braces">
    Put all method fields in the JSON body. Market API requests are signed in the body; they do not use an `X-API-Key` header.
  </Step>

  <Step title="Generate signature" icon="shield-check">
    Hash sorted request fields with your secret key, then add the resulting `signature` field.
  </Step>

  <Step title="Send POST request" icon="send">
    POST to `user-api.neverlose.cc/api/market/<method>` with `Content-Type: application/json`.
  </Step>
</Steps>

## Request Examples

<Tabs>
  <Tab title="Grant Item" icon="package-check">
    Grants one of your own paid, approved, and public marketplace items by its listing `code`. Write methods need a unique `id` so retrying the same request cannot execute it twice.

    ```bash
    curl 'https://user-api.neverlose.cc/api/market/give-for-free' \
      -X POST \
      -H 'Content-Type: application/json' \
      --data '{
        "user_id": 1,
        "id": "first-grant-001",
        "username": "target_user",
        "code": "E3yugw",
        "signature": "..."
      }'
    ```
  </Tab>

  <Tab title="Read Balance" icon="coins">
    Read-only methods do not need `id`; they still need `user_id` and `signature`.

    ```bash
    curl 'https://user-api.neverlose.cc/api/market/get-balance' \
      -X POST \
      -H 'Content-Type: application/json' \
      --data '{
        "user_id": 1,
        "signature": "..."
      }'
    ```
  </Tab>
</Tabs>

## Response Shape

<Tabs title="Response example" copyable>
  <Tab title="Success" icon="circle-check">
    ```json
    {
      "succ": true,
      "success": true
    }
    ```
  </Tab>

  <Tab title="Failure" icon="circle-x">
    ```json
    {
      "succ": false,
      "success": false,
      "error": "Error message"
    }
    ```
  </Tab>
</Tabs>

## Next Steps

<Columns cols={3}>
  <Card title="API Requests" icon="send" href="/market/api-requests/api-requests">
    Shared endpoint format, common parameters, request IDs, and product names.
  </Card>

  <Card title="Signatures" icon="shield-check" href="/market/authentication/signatures">
    Generate request signatures and validate callback signatures.
  </Card>

  <Card title="API Reference" icon="code" href="/market/api/post-give-for-free">
    Open the generated endpoint reference for method-specific fields.
  </Card>
</Columns>
