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

# Understanding the Shareable URL Structure

> Learn how Crust AI Snippet URLs are built and how parameters control the viewed data and permissions.

<Tip>
  **Gateway to Your Data**\
  Every Crust AI Snippet you create is fundamentally accessible via a unique **Shareable URL**. This web link is the gateway for your viewers to access the specific data view you've configured. Think of the URL not just as an address, but as a set of instructions telling Crust AI *which* snippet to load, *how* to display it initially, and potentially *which specific record* or *user context* applies.
</Tip>

Understanding how Snippet URLs are constructed is crucial for:

* **Sharing snippets** effectively.
* **Integrating snippets** into automations or button fields.
* **Using snippets** within external workflow tools (Make, Zapier, n8n).
* **Building robust applications** by linking multiple snippets together.

***

## The Anatomy of a Snippet URL

A typical Crust AI Snippet URL follows this basic structure:

```text URL Structure Example theme={null}
https://app.trycrust.ai/<snippet_id>/<view_type>?<optional_parameter>
```

Let's break down each part:

<ResponseField name="Base Platform URL" type="string (constant)">
  `https://app.trycrust.ai/` - This is the standard starting point for accessing any snippet viewer on the Crust AI platform.
</ResponseField>

<ResponseField name="Snippet ID" type="string (unique ID)">
  `<snippet_id>` - A unique string automatically generated by Crust AI when you create a snippet. It identifies *which specific snippet configuration* (linked table, design, filters, permissions, etc.) should be loaded. You'll see this ID as part of the URL generated in Step 4 of the builder.
</ResponseField>

<ResponseField name="View Type" type="'detail' | 'list'">
  `<view_type>` - Specifies the initial view mode for the snippet:

  * `detail`: Loads the **Detail View**. Always used for Single Item snippets and when navigating to a specific record's detail view within a Multiple Items Snippet.
  * `list`: Loads the **List View**. Only applicable to Multiple Items snippets.
</ResponseField>

<ResponseField name="Optional URL Parameter" type="?rec=<record_id> | ?p=<permission_value>">
  `?<optional_parameter>` - An optional key-value pair providing additional context. See details below.
</ResponseField>

***

## Key URL Parameters Explained

These optional parameters are added after the `?` and provide critical context, especially for targeting specific data or users

<ResponseField name="Record Parameter (rec)" type="string (Record ID)">
  **Format:** `?rec=recXXXXXXXXXXXXXX`

  **Purpose:** Specifies the exact record whose details should be displayed (record ID for Airtable, page ID for Notion, row ID for Monday.com, Custom Crust AI ID for Google Sheets).

  **When Used:** **Mandatory** whenever the `View Type` is `detail`. It tells Crust AI which specific record's data to fetch and render in the Detail View.

  **Applies To:**

  * **Single Item Snippets:** Defines the *only* record this snippet URL will ever show.
  * **Multiple Items Snippets (Detail View):** Used internally when navigating from the List View to a specific item's Detail View (`/detail?rec=<clicked_record_id>`).
</ResponseField>

<ResponseField name="Permission Parameter (p)" type="string (User Identifier)">
  **Format:** `?p=value` (e.g., `?p=jamie@example.com` or `?p=recABCXYZ`)

  **Purpose:** Provides the viewer's unique identifier when **User-based Permission** is enabled for a Multiple Items Snippet.

  **When Used:** **Optional**, but only relevant when the `View Type` is `list` *and* "User-based permission" is configured in Step 2.

  **Applies To:**

  * **Multiple Items Snippets (List View with User-based Permission):** Tells Crust AI how to dynamically filter the list based on the viewer's identity. If omitted, the user may be prompted for their identifier.
</ResponseField>

***

## How Permissions Affect the URL and Viewer Experience (`/list` view)

Understanding the interplay between User-based Permissions and the `p` parameter is vital:

### Scenario 1: User-based Permission ON, `p` Parameter MISSING

```md URL Example theme={null}
https://app.trycrust.ai/<snippet_id>/list
```

<Accordion title="What Happens">
  * **Viewer accesses:** `https://app.trycrust.ai/<snippet_id>/list`
  * **Result:** Crust AI sees User-based Permission is required but doesn't know the viewer's identifier. It displays the **"Access Required" screen**, prompting the user to enter their permission value (e.g., their email).
  * **Behind the Scenes:** Once the user enters their value and continues, Crust AI essentially appends `?p=<entered_value>` to the URL internally and then filters the records accordingly.
</Accordion>

### Scenario 2: User-based Permission ON, `p` Parameter PRESENT (Direct URL / Magic Link)

```md URL Example theme={null}
https://app.trycrust.ai/<snippet_id>/list?p=jamie@example.com
```

<Accordion title="What Happens">
  * **Viewer accesses:** `https://app.trycrust.ai/<snippet_id>/list?p=jamie@example.com`
  * **Result:** Crust AI sees User-based Permission is required *and* receives the identifier (`jamie@example.com`) directly from the URL. It **bypasses the "Access Required" screen** and immediately displays the List View, showing only records where the configured Permission Field matches `jamie@example.com`.
</Accordion>

### Scenario 3: "Anyone with the link" Permission ON

```md URL Example theme={null}
https://app.trycrust.ai/<snippet_id>/list
```

<Accordion title="What Happens">
  * **Viewer accesses:** `https://app.trycrust.ai/<snippet_id>/list`
  * **Result:** Crust AI sees no specific permission check is needed. It displays the List View showing *all* records that pass any static filters set in Step 2. The `p` parameter is ignored even if present.
</Accordion>

***

## Why is this Structure Important?

<Info>
  **Key Benefits**

  * **Targeted Sharing:** Allows you to create URLs that point to specific records (using `rec`) or filtered views for specific users (using `p`).
  * **Automation:** You can programmatically generate these URLs in you data sources (using formulas and `RECORD_ID()` or user identifier fields) or in tools like Make/Zapier to send personalized links automatically.
  * **Navigation:** When building multi-snippet applications, understanding how to pass the correct `rec` or `p` parameter from one snippet's button to the URL of the next snippet is essential for creating seamless user flows.
</Info>

***

Mastering the structure of Crust AI's Shareable URLs unlocks the platform's full potential for creating dynamic, secure, and integrated data applications based on your data source setup.
