> For the complete documentation index, see [llms.txt](https://docs.api.market/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.api.market/seller-docs/testing-your-apis-and-products.md).

# Testing Your APIs & Products

To enable easy testing for yourself and for your users, we recommend creating a Free product with this config:

* Price: $0/month
* API Calls: 100
* Limit Type: HARD

<figure><img src="/files/fQWP5839IFYqLgmh09Yk" alt=""><figcaption></figcaption></figure>

To test your product follow these steps:

1. **Browse to the Product Page**: Navigate to the product page on your API store (e.g., from the marketplace or search results).
2. **Subscribe to the Product**:
   * On the product page, select the "FREE" pricing plan (or any plan you want to test)
   * Click the "Subscribe" button to subscribe to the product
   * Complete the subscription process if payment is required (for free plans, this is usually instant)
3. **Access API Playground**:
   * After subscribing, you'll see the "API Playground (Try the APIs)" section on the product page
   * This section displays all available endpoints for the product
   * You can view endpoint details, request/response schemas, and test endpoints directly
4. **Copy the Endpoint URL**:
   * From the API Playground, find the endpoint you want to call
   * Copy the full endpoint URL (e.g., `https://prod.api.market/api/v1/{workspace-slug}/{product-slug}/{endpoint-path}`)

**Example:**

For an endpoint that looks like this, you can send a POST request using any of the methods described below:

{% tabs %}
{% tab title="Shell" %}

```bash
curl -X POST "https://prod.api.market/api/v1/magicapi/gpt-5/chat/completions" \
-H "Content-Type: application/json" \
-H "x-api-market-key: YOUR_API_MARKET_KEY" \
-d '{
  "model": "gpt-5",
  "messages": [
    {
      "role": "user",
      "content": "What is the capital of France?"
    }
  ]
}'

```

{% endtab %}

{% tab title="Javascript" %}

```bash
const apiKey = "YOUR_API_MARKET_KEY";
const baseUrl = "https://prod.api.market/api/v1/magicapi/gpt-5";

async function getCompletion(messages) {
  try {
    const response = await fetch(`${baseUrl}/chat/completions`, {
      method: "POST",
      headers: {
        "Content-Type": "application/json",
        "x-api-market-key": apiKey
      },
      body: JSON.stringify({ model: "gpt-5", messages: messages })
    });

    if (!response.ok) {
      const errorData = await response.json();
      throw new Error(`API error: ${response.status} ${errorData.error.message}`);
    }

    return await response.json();
  } catch (error) {
    console.error("Error:", error);
    throw error;
  }
}


// Example usage
const messages = [{"role": "user", "content": "Hello, how are you?"}];
getCompletion(messages)
  .then(completion => console.log(completion))
  .catch(error => console.error(error));



```

{% endtab %}

{% tab title="Python" %}

```bash
# Python example
import requests

API_KEY = "YOUR_API_MARKET_KEY"
BASE_URL = "https://prod.api.market/api/v1/magicapi/gpt-5"

def get_completion(messages):
    headers = {
        "Content-Type": "application/json",
        "x-api-market-key": API_KEY
    }
    
    response = requests.post(
        f"{BASE_URL}/chat/completions",
        headers=headers,
        json={"model": "gpt-5", "messages": messages}
    )
    
    if response.status_code != 200:
        error_data = response.json()
        raise Exception(f"API error: {response.status_code} {error_data['error']['message']}")
    
    return response.json()


# Example usage:
messages = [{"role": "user", "content": "Translate 'Hello, how are you?' to French."}]
try:
    completion = get_completion(messages)
    print(completion)
except Exception as e:
    print(f"An error occurred: {e}")

```

{% endtab %}
{% endtabs %}

**You can use tools like Postman to test your API as well:**

<figure><img src="/files/hNR6FFyOfqtL4cdzmMif" alt=""><figcaption></figcaption></figure>

PostMan request for api.market
