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

# List Impressions

> Retrieve a list of all QR code scans from posters in your programs

Retrieve a list of all QR code scans (impressions) from posters in your programs. This endpoint helps you track engagement, monitor scan activity, and analyze which posters are performing best.

## Overview

The List Impressions endpoint returns a paginated list of all QR code scans. Use this endpoint to:

* Track all QR code scans across your programs
* Monitor which posters generate the most engagement
* Filter impressions by program or poster
* Build analytics dashboards for scan activity
* Analyze conversion funnel from scan to signup

## Authentication

This endpoint requires authentication using a Bearer token in the Authorization header:

```bash theme={null}
Authorization: Bearer sk_your_secret_key_here
```

## Query Parameters

<ParamField body="programId" type="string" required={false}>
  Filter results to only include impressions from a specific program. Useful when analyzing scan activity for individual programs.

  **Example:** `programId=prog_123abc`
</ParamField>

<ParamField body="posterId" type="string" required={false}>
  Filter results to only include impressions from a specific poster. Use this to see all scans for a particular poster placement.

  **Example:** `posterId=poster_123abc`
</ParamField>

<ParamField body="limit" type="integer" default="50" required={false}>
  Maximum number of results to return per page. Default is 50, maximum is typically 100.

  **Example:** `limit=25`
</ParamField>

<ParamField body="offset" type="integer" default="0" required={false}>
  Number of results to skip before starting to return results. Use for pagination.

  **Example:** `offset=50` skips the first 50 results
</ParamField>

## Request Example

<RequestExample>
  ```bash theme={null}
  # Get all impressions
  curl -X GET "https://vantio.app/api/v1/impressions" \
    -H "Authorization: Bearer sk_your_secret_key_here"

  # Get impressions from a specific program
  curl -X GET "https://vantio.app/api/v1/impressions?programId=prog_123abc&limit=100" \
    -H "Authorization: Bearer sk_your_secret_key_here"

  # Get impressions from a specific poster
  curl -X GET "https://vantio.app/api/v1/impressions?posterId=poster_123abc" \
    -H "Authorization: Bearer sk_your_secret_key_here"
  ```
</RequestExample>

## Response

The API returns a JSON object containing an array of impression objects:

<ResponseField name="impressions" type="array" required>
  Array of impression objects, each containing information about a QR code scan.
</ResponseField>

Each impression object contains:

<ResponseField name="id" type="string" required>
  Unique identifier for the impression. This ID is used when creating referrals.
</ResponseField>

<ResponseField name="poster_id" type="string" required>
  ID of the poster whose QR code was scanned.
</ResponseField>

<ResponseField name="program_id" type="string" required>
  ID of the program this impression belongs to.
</ResponseField>

<ResponseField name="student_id" type="string" required>
  ID of the student ambassador who placed the poster.
</ResponseField>

<ResponseField name="scanned_at" type="string" required>
  ISO 8601 timestamp of when the QR code was scanned.
</ResponseField>

<ResponseField name="user_agent" type="string">
  User agent string of the device that scanned the QR code.
</ResponseField>

<ResponseField name="ip_address" type="string">
  IP address of the device that scanned the QR code (if available).
</ResponseField>

<ResponseField name="metadata" type="object">
  Additional metadata about the scan, such as device type, location, or custom fields.
</ResponseField>

## Response Example

<ResponseExample>
  ```json theme={null}
  {
    "impressions": [
      {
        "id": "imp_123abc",
        "poster_id": "poster_123abc",
        "program_id": "prog_123abc",
        "student_id": "user_123abc",
        "scanned_at": "2024-01-15T10:30:00Z",
        "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 17_0 like Mac OS X)",
        "ip_address": "192.168.1.1",
        "metadata": {
          "device_type": "mobile",
          "location": "campus_center"
        }
      },
      {
        "id": "imp_456def",
        "poster_id": "poster_123abc",
        "program_id": "prog_123abc",
        "student_id": "user_123abc",
        "scanned_at": "2024-01-15T11:15:00Z",
        "user_agent": "Mozilla/5.0 (Android 13; Mobile)",
        "ip_address": "192.168.1.2",
        "metadata": {
          "device_type": "mobile",
          "location": "library"
        }
      }
    ]
  }
  ```
</ResponseExample>

## Use Cases

### Building an Impressions Dashboard

Fetch all impressions and display them in a dashboard:

```javascript theme={null}
async function fetchImpressions(filters = {}) {
  const params = new URLSearchParams();
  
  if (filters.programId) params.append('programId', filters.programId);
  if (filters.posterId) params.append('posterId', filters.posterId);
  if (filters.limit) params.append('limit', filters.limit);
  if (filters.offset) params.append('offset', filters.offset);
  
  const response = await fetch(
    `https://vantio.app/api/v1/impressions?${params.toString()}`,
    {
      headers: {
        'Authorization': `Bearer ${API_KEY}`
      }
    }
  );
  
  return await response.json();
}
```

### Analyzing Poster Performance

See which posters generate the most scans:

```javascript theme={null}
async function getPosterScanStats(programId) {
  const impressions = await fetchImpressions({ programId, limit: 1000 });
  
  // Count scans by poster
  const stats = {};
  impressions.impressions.forEach(impression => {
    if (!stats[impression.poster_id]) {
      stats[impression.poster_id] = 0;
    }
    stats[impression.poster_id]++;
  });
  
  return stats;
}
```

### Tracking Conversion Funnel

Link impressions to referrals to track conversion:

```javascript theme={null}
async function getConversionFunnel(posterId) {
  const impressions = await fetchImpressions({ posterId, limit: 1000 });
  
  // For each impression, check if there's a corresponding referral
  const funnel = {
    scans: impressions.impressions.length,
    signups: 0,
    conversions: 0
  };
  
  for (const impression of impressions.impressions) {
    // Check if referral exists for this impression
    const referrals = await fetchReferrals({ 
      // You would need to filter by impression_id if supported
    });
    
    // Count signups and conversions
    // This is a simplified example
  }
  
  return funnel;
}
```

### Exporting Impression Data

Fetch all impressions for export:

```javascript theme={null}
async function exportAllImpressions(programId) {
  let allImpressions = [];
  let offset = 0;
  const limit = 100;
  let hasMore = true;
  
  while (hasMore) {
    const response = await fetch(
      `https://vantio.app/api/v1/impressions?programId=${programId}&limit=${limit}&offset=${offset}`,
      {
        headers: {
          'Authorization': `Bearer ${API_KEY}`
        }
      }
    );
    
    const data = await response.json();
    allImpressions = [...allImpressions, ...data.impressions];
    
    hasMore = data.impressions.length === limit;
    offset += limit;
  }
  
  return allImpressions;
}
```

## Best Practices

1. **Use filters effectively** - Combine programId and posterId to narrow results
2. **Implement pagination** - Always use `limit` and `offset` for large datasets
3. **Link to referrals** - Use impression IDs when creating referrals to maintain the funnel
4. **Track device types** - Use metadata to store device information for analytics
5. **Monitor scan rates** - Compare impressions to poster placements to measure engagement

## Error Responses

<ResponseField name="401" type="object">
  **Unauthorized** - Invalid or missing API key

  ```json theme={null}
  {
    "error": "Unauthorized",
    "message": "Invalid or missing API key"
  }
  ```
</ResponseField>

## Rate Limits

This endpoint is subject to rate limiting. Check response headers for rate limit information.


## OpenAPI

````yaml GET /api/v1/impressions
openapi: 3.0.0
info:
  title: Vantio API
  version: 1.0.0
  description: >-
    Public v1 API. Authenticate using your secret key in the Authorization
    header: "Bearer sk_...".
servers:
  - url: http://localhost:3000
security:
  - bearerAuth: []
tags:
  - name: Users
    description: Student directory within your programs
  - name: Referrals
    description: Signups and conversions
  - name: Posters
    description: Ambassador posters and placements
  - name: Impressions
    description: QR scans and related activity
  - name: Earnings
    description: Earnings from referrals
paths:
  /api/v1/impressions:
    get:
      tags:
        - Impressions
      summary: List impressions (QR code scans)
      description: Retrieve a list of all QR code scans from posters in your programs
      parameters:
        - in: query
          name: programId
          schema:
            type: string
          description: Filter by program ID
        - in: query
          name: posterId
          schema:
            type: string
          description: Filter by poster ID
        - in: query
          name: limit
          schema:
            type: integer
            default: 50
          description: Maximum number of results to return
        - in: query
          name: offset
          schema:
            type: integer
            default: 0
          description: Number of results to skip
      responses:
        '200':
          description: List of impressions
          content:
            application/json:
              schema:
                type: object
        '401':
          description: Unauthorized - Invalid or missing API key
      security:
        - bearerAuth: []
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: API Key

````