# ⚡ Fast Snap

## OpenAPI Specification

```yaml
openapi: 3.0.1
info:
  title: ''
  description: ''
  version: 1.0.0
paths:
  /snap:
    get:
      summary: ⚡ Fast Snap
      deprecated: false
      description: >

        **Description:**


        The **Fast Snap API** allows you to instantly use Snapbyte’s caching
        system **in a single call**, without needing to preload or register the
        file in advance.


        Use it for:

        - Rapid integration


        **Query Parameters:**

        - `file_id`: A unique identifier you define

        - `sign_url`: The original file URL hosted on your origin server


        ---


        **How it Works:**


        1. Snapbyte checks whether the file associated with `file_id` is already
        cached.

        2. If **cached**, it redirects the user to the cached file.

        3. If **not cached**, Snapbyte fetches the file from `sign_url`, stores
        it in the cache, and prepares it for future access.

        4. In both cases, the API responds with:


        ```http

        302 Found

        Location: [Snapbyte cached URL] or [original sign_url]

        ```


        ## 🌐 Domain Whitelisting


        To ensure secure usage and prevent abuse, Snapbyte requires you to
        **whitelist the origin domains** you plan to use with `sign_url`.


        ### ✅ How It Works


        Before using the `sign_url` parameter in the Fast Snap API or any
        dynamic fetch request, the domain must be whitelisted in your account.


        Example:

        - If you're serving files from `https://files.example.com/file.mp4`

        - You should whitelist: `files.example.com`


        ### 🔧 How to Whitelist a Domain


        You can whitelist domains in two ways:


        1. **Via the Dashboard**
           - Go to your Snapbyte Dashboard
           - Navigate to **Domain Whitelist**
           - Add your domain(s) (e.g., `cdn.example.com`)
           - Save and apply changes

        2. **Via API**


        `POST /v1/domain/pattern`

        ---


        ### ⚠️ Error Handling


        If you attempt to use a domain that hasn’t been whitelisted:

        ```http

        403 Forbidden

        ```
      tags: []
      parameters:
        - name: file_id
          in: query
          description: ''
          required: true
          example: 4d687a14-98e1-4a8a-b97f-43d7cf85b68f
          schema:
            type: string
        - name: sign_url
          in: query
          description: ''
          required: true
          example: https://ash-speed.hetzner.com/100MB.bin
          schema:
            type: string
      responses:
        '302':
          description: ''
          headers: {}
          x-apidog-name: OK
      security: []
      x-apidog-folder: ''
      x-apidog-status: released
      x-run-in-apidog: https://app.apidog.com/web/project/991601/apis/api-19032346-run
components:
  schemas: {}
  securitySchemes: {}
servers:
  - url: https://api.snapbyte.io
    description: Prod Env
security: []

```
