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

---
title: "Quick start"
description: "Get your API key and send your first Rye API request!"
---

<Note>
  For a live production example of creating an order using the Rye SDK in TypeScript, check out our [Order from Amazon in TypeScript](/order-from-amazon-typescript) guide.
</Note>

<Steps>
  <Step title="Grab your API Key">
    To make requests to the Rye GraphQL API, you will need to get an API access key by signing up on the Rye console. To do so:

    1. Navigate, and log in to [https://staging.console.rye.com](https://staging.console.rye.com)
    2. Under Access and Security, view and copy your API key

    <Image src="/_holocron/images/7139ed00-d883882-image.png" alt="Grab the API header from console" width="802" height="418" placeholder="data:image/webp;base64,UklGRoYAAABXRUJQVlA4WAoAAAAQAAAADwAABwAAQUxQSCsAAAABJ6AgbQPGv+V2x0ZExM8KhQDQMNUEQhnC/LWuQkT/JyDQXVg5GW8uuwYnAFZQOCA0AAAA0AEAnQEqEAAIAALATCWkAALng30+rAAA/vCP+1x/wW7om/ecbyV6Qn7JIthwJeUJGZFAAA==" />

    Grab the API header from console

    Find out more about [authorizations](api-reference/authorization) needed to use Rye.
  </Step>

  <Step title="Install a GraphQL library">
    Rye APIs are exposed via [GraphQL](/get-started/intro-to-graphql). While it is possible to make requests to Rye using any HTTP client, we recommend using a dedicated GraphQL client library for ease of use. This tutorial will use the [`graphql-request`](https://www.npmjs.com/package/graphql-request) library as it is lightweight and easy to use. You can install it using any Node.js package manager:

    <Tabs items={["npm", "yarn", "pnpm"]}>
      <Tab title="npm">
        ```bash
        npm install graphql-request
        ```
      </Tab>

      <Tab title="yarn">
        ```bash
        yarn add graphql-request
        ```
      </Tab>

      <Tab title="pnpm">
        ```bash
        pnpm add graphql-request
        ```
      </Tab>
    </Tabs>
  </Step>

  <Step title="Initialize a GraphQL client">
    Initialize a GraphQL client with [your API key](/authorization-headers) via the following recipe:

    ```javascript
    import { GraphQLClient, gql } from 'graphql-request';

    const endpoint = 'https://staging.graphql.api.rye.com/v1/query';
    const client = new GraphQLClient(endpoint)
    const headers = {
      'Authorization': 'Basic <API Key Here>',
      'Rye-Shopper-IP': '127.0.0.1',
    };
    ```

    <Note>
      For a real integration, the `Rye-Shopper-IP` header should be set to the IP address of the shopper making the request. This is important for fraud detection and prevention.
    </Note>
  </Step>

  <Step title="Making your first GraphQL request">
    Here is an example of fetching some products via GraphQL using the client we just set up.

    <Tabs items={["Shopify", "Amazon"]}>
      <Tab title="Shopify">
        ```javascript
        async function fetchProduct() {
          const query = gql`
            query DemoShopifyProductFetch($input: ProductByIDInput!) {
              product: productByID(input: $input) {
                title
                vendor
                url
                isAvailable
                images {
                  url
                }
                price {
                  displayValue
                }
                ... on ShopifyProduct {
                  productType
                }
              }
            }
          `;

          const variables = {
            input: {
              id: '7074033139917',
              marketplace: 'SHOPIFY',
            },
          };

          const data = await client.request(query, variables, headers);
          console.log(JSON.stringify(data, undefined, 2));
        }

        await fetchProduct();
        ```
      </Tab>

      <Tab title="Amazon">
        ```javascript
        async function fetchProduct() {
          const query = gql`
            query DemoAmazonProductFetch($input: ProductByIDInput!) {
              product: productByID(input: $input) {
                title
                vendor
                url
                isAvailable
                images {
                  url
                }
                price {
                  displayValue
                }
                ... on AmazonProduct {
                  ASIN
                }
              }
            }
          `;

          const variables = {
            input: {
              id: 'B09H6T8LTR',
              marketplace: 'AMAZON',
            },
          };

          const data = await client.request(query, variables, headers);
          console.log(JSON.stringify(data, undefined, 2));
        }

        await fetchProduct();
        ```
      </Tab>
    </Tabs>
  </Step>

  <Step title="Explore the rest of the API">
    Explore the entire API offering live on the [Rye Console](https://staging.console.rye.com/). Take a glance through the remaining docs to figure out how the Rye API can integrate into your app!
  </Step>
</Steps>


---

*Powered by [holocron.so](https://holocron.so)*
