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

# Quickstart

> Get your API key and send your first Buybase API request!

In this quickstart guide, you'll learn how to:

1. Create a profile for your Buybase app.
2. Add style preferences.
3. Attach shipping details.
4. Perform personalized product searches.

<Steps>
  <Step title="Grab your API key">
    <p>
      Go to the [Buybase Developer Dashboard](https://devs.buybase.ai) and grab your API key.
    </p>
  </Step>

  <Step title="Create a Profile">
    Profiles store user preferences and shipping details for personalized experiences.

    ```javascript theme={null}
    const axios = require('axios');

    async function createProfile() {
      const response = await axios.post('https://api.buybase.ai/profiles/create', {}, {
        headers: {
          'Authorization': `Bearer ${process.env.BUYBASE_API_KEY}`,
          'Content-Type': 'application/json',
        },
      });

      console.log('Profile ID:', response.data.profile.id);
      return response.data.profile.id;
    }

    // Usage
    createProfile().catch(console.error);
    ```
  </Step>

  <Step title="Add Style Preferences">
    Attach style preferences to enhance product recommendations.

    ```javascript theme={null}
    async function createStyleProfile(profileId, styleDescription) {
      const response = await axios.post('https://api.buybase.ai/styles/create', {
        profile_id: profileId,
        text: styleDescription,
      }, {
        headers: {
          'Authorization': `Bearer ${process.env.BUYBASE_API_KEY}`,
          'Content-Type': 'application/json',
        },
      });

      console.log('Style ID:', response.data.style.id);
      return response.data.style.id;
    }

    // Usage
    createStyleProfile('prof_12345', 'Minimalist casual, neutral colors').catch(console.error);
    ```
  </Step>

  <Step title="Add Shipping Details">
    Store shipping info to streamline checkout.

    ```javascript theme={null}
    async function createShippingAddress(profileId, shippingDetails) {
      const response = await axios.post('https://api.buybase.ai/shipping/create', {
        profile_id: profileId,
        shipping_address: shippingDetails,
      }, {
        headers: {
          'Authorization': `Bearer ${process.env.BUYBASE_API_KEY}`,
          'Content-Type': 'application/json',
        },
      });

      console.log('Shipping ID:', response.data.shipping.id);
      return response.data.shipping.id;
    }

    // Usage
    createShippingAddress('prof_12345', {
      first_name: 'John',
      last_name: 'Doe',
      email: 'john.doe@example.com',
      phone: '+1234567890',
      address_1: '123 Main St',
      address_2: 'Apt 4B',
      city: 'San Francisco',
      country_code: 'US',
      province_code: 'CA',
      postal_code: '94105',
    }).catch(console.error);
    ```
  </Step>

  <Step title="Search for Products with Profile">
    Use natural language and personalization to search products.

    ```javascript theme={null}
    async function searchProducts(profileId, query) {
      const response = await axios.post('https://api.buybase.ai/search/products', {
        profile_id: profileId,
        query: { text: query },
        query_weight: 0.7,
        style_weight: 0.3,
        similarity_threshold: 0.25,
        result_count: 2,
      }, {
        headers: {
          'Authorization': `Bearer ${process.env.BUYBASE_API_KEY}`,
          'Content-Type': 'application/json',
        },
      });

      response.data.results.forEach(product => {
        console.log(`${product.title}: $${product.variants[0].price}`);
        console.log(`Checkout URL: ${product.variants[0].checkout_url_with_shipping}`);
      });
    }

    // Usage
    searchProducts('prof_12345', 'Comfortable city walking shoes').catch(console.error);
    ```
  </Step>
</Steps>

Explore more in the [API Reference](https://buybase.ai/docs).
