Fynd Platform and Storefront APIs

website·Indexed 36 days ago

https://docs.fynd.com/

Developer documentation for Fynd, featuring the Platform REST API for programmatic company management, the Storefront REST API for storefront customization, and the Storefront GraphQL API for flexible data querying.

Tokens
2.8K
Snippets
16
Records
24
Agent score
59%

What's inside Fynd

  1. Overview of the Storefront REST API

    The Application API (also known as the Storefront API) allows developers to customize online storefronts by providing access to the same data customers see during browsing. Key capabilities include retrieving product information (products, collections, variants), accessing customer orders, and managing the checkout process (adding items, applying discounts, and processing payments).
  2. Overview of Fynd Platform REST API

    The Platform API allows developers to programmatically manage a Fynd Platform company, providing access to the same data and operations available in the platform panel (e.g., managing products, inventory, and orders). The API operates at two levels:

    1. Company Level: Requires company_id. Provides access to data across the entire company and all its applications (sales channels).
    2. Application Level: Requires both company_id and application_id. Provides access to data for a specific application within the company.
  3. Understand Fynd Platform API scopes

    The Platform API provides programmatic access to Fynd Platform company data. It operates at two distinct levels:

    1. Company Level: Requires the company_id parameter. Provides access to data across the entire company and all its associated sales channels (applications).
    2. Application Level: Requires both company_id and application_id parameters. Provides access to data specific to a single application within the company.
  4. Obtain an access token using client credentials

    To get an access token for a specific company, make a POST request to the /oauth/token endpoint.

    Authentication Requirement: The Authorization header must contain a Base64 encoded string of {client_id}:{client_secret} passed as a Basic auth token.

    Constraint: Tokens obtained via this flow are limited to the single company associated with the credentials.

    # 1. Generate the Base64 token string
    base64TokenString=$(echo -n {client_id}:{client_secret} | base64)
    
    # 2. Request the access token
    curl -X POST "https://api.fynd.com/service/panel/authentication/v1.0/company/{company_id}/oauth/token" \
    -H "Authorization: Basic {base64TokenString}" \
    -H 'Content-Type: application/json' \
    -d '{"grant_type":"client_credentials"}'
  5. Obtain an access token using client credentials

    To obtain an access token for a specific company, make a POST request to the /oauth/token endpoint.

    Authentication Requirement: The Authorization header must contain the string Basic {base64TokenString}, where {base64TokenString} is the base64 encoded combination of client_id:client_secret.

    Constraint: Tokens obtained via this flow are limited to the single company associated with the credentials.

    # Step 1: Convert client_id and client_secret to base64
    base64TokenString=$(echo -n {client_id}:{client_secret} | base64)
    
    # Step 2: Request the access token
    curl -X POST "https://api.fynd.com/service/panel/authentication/v1.0/company/{company_id}/oauth/token" \
    -H "Authorization: Basic {base64TokenString}" \
    -H 'Content-Type: application/json' \
    -d '{"grant_type":"client_credentials"}'
  6. Use the GraphQL Explorer for API testing

    The GraphQL Explorer is an interactive tool for testing queries and mutations without writing code. It features:

    • Interactive Query Building: Point-and-click interface to select fields.
    • Schema Exploration: Browse types, fields, and documentation.
    • Autocomplete: Intelligent suggestions while typing.
    • Variables: A dedicated pane to define dynamic query variables.
    • History: Ability to reuse previous requests.
  7. Make authenticated requests to Platform APIs

    Once you have retrieved an access_token via the OAuth flow, include it in the Authorization header of your API requests using the Bearer scheme.
    curl -X GET "https://api.fynd.com/service/platform/configuration/v1.0/company/{company_id}/application" \
    -H "Authorization: Bearer {access_token}"
  8. Retrieve application credentials from Fynd Platform

    To authenticate requests, you need an application_id and application_token. These are retrieved from the Fynd Platform panel:

    1. Log in to the Fynd Platform.
    2. Select your company from the list to open the Dashboard.
    3. Navigate to the Developers tab in the sidebar to open the APIs & SDKs page.
    4. Click the Application Token tab to view the credentials for your specific application (sales channel).
  9. Retrieve Client ID and Client Secret from Fynd Platform

    To authenticate using client credentials, you must first generate them in the platform panel:

    1. Log in to the Fynd Platform account and select the target company.
    2. Navigate to the Developers tab in the sidebar to open the APIs & SDKs page.
    3. Click the Clients tab.
    4. Click Create Client, fill in the required details and permissions, and save.
    5. Copy the generated Client Id and Client Secret.
  10. Authenticate requests to the Storefront GraphQL API

    To authenticate requests, you must provide an Authorization header. The value is a Bearer token consisting of the application_id and application_token joined by a colon and encoded in base64.

    Steps to obtain credentials:

    1. Log in to the Fynd Platform.
    2. Select your company from the list.
    3. Navigate to the Developers tab in the sidebar $\rightarrow$ APIs & SDKs page.
    4. Click the Application Token tab to find the credentials for your specific sales channel.
    # Generate the base64 token string
    base64TokenString=$(echo -n {application_id}:{application_token} | base64)
    
    # Use in the Authorization header
    # Authorization: Bearer <base64TokenString>