API Docs

This document describes the API endpoints available for managing QR codes.

Authentication

All API requests must be authenticated using an API key. Include your API key in the request header:

X-API-Key: your_api_key_here

API keys can be generated and managed from the API Keys section in your dashboard.

API Endpoints

List QR Codes

GET /api/v1/qrcodes

Retrieves a list of all QR codes owned by the authenticated user.

Query Parameters:

  • search (optional): Filter QR codes by name

Response:

[
  {
    "id": "string",
    "shortCode": "string",
    "name": "string",
    "type": "WEBSITE" | "TEXT",
    "data": {
      "url": "string"      // for WEBSITE type
      "content": "string"  // for TEXT type
    },
    "isDynamic": boolean,
    "createdAt": "date",
    "updatedAt": "date",
    "_count": {
      "scans": number
    }
  }
]

Get QR Code

GET /api/v1/qrcodes/{shortCode}

Retrieves a specific QR code by its short code.

Response:

{
  "id": "string",
  "shortCode": "string",
  "name": "string",
  "type": "WEBSITE" | "TEXT",
  "data": {
    "url": "string"      // for WEBSITE type
    "content": "string"  // for TEXT type
  },
  "isDynamic": boolean,
  "createdAt": "date",
  "updatedAt": "date"
}

Create QR Code

POST /api/v1/qrcodes

Creates a new QR code.

Request Body:

{
  "name": "string",
  "type": "WEBSITE" | "TEXT",
  "data": {
    "url": "string"      // for WEBSITE type
    "content": "string"  // for TEXT type
  },
  "isActive": boolean,           // optional, defaults to true
  "startDate": "ISO datetime",   // optional, start date for time-based access
  "endDate": "ISO datetime"      // optional, end date for time-based access
}

Response:

{
  "id": "string",
  "shortCode": "string",
  "name": "string",
  "type": "WEBSITE" | "TEXT",
  "data": {
    "url": "string"      // for WEBSITE type
    "content": "string"  // for TEXT type
  },
  "isDynamic": boolean,
  "isActive": boolean,
  "startDate": "date",           // null if not set
  "endDate": "date",             // null if not set,
  "createdAt": "date",
  "updatedAt": "date"
}

Update QR Code

PUT /api/v1/qrcodes/{shortCode}

Updates an existing QR code.

Request Body:

{
  "name": "string",
  "type": "WEBSITE" | "TEXT",
  "data": {
    "url": "string"      // for WEBSITE type
    "content": "string"  // for TEXT type
  },
  "isActive": boolean,           // optional
  "startDate": "ISO datetime",   // optional, start date for time-based access
  "endDate": "ISO datetime"      // optional, end date for time-based access
}

Response:

{
  "id": "string",
  "shortCode": "string",
  "name": "string",
  "type": "WEBSITE" | "TEXT",
  "data": {
    "url": "string"      // for WEBSITE type
    "content": "string"  // for TEXT type
  },
  "isDynamic": boolean,
  "isActive": boolean,
  "startDate": "date",           // null if not set
  "endDate": "date",             // null if not set,
  "createdAt": "date",
  "updatedAt": "date"
}

Delete QR Code

DELETE /api/v1/qrcodes/{shortCode}

Deletes a QR code.

Response: HTTP 204 No Content

Error Responses

The API uses standard HTTP status codes to indicate the success or failure of requests:

  • 200 OK: Request successful
  • 201 Created: Resource created successfully
  • 204 No Content: Resource deleted successfully
  • 401 Unauthorized: Invalid or missing API key
  • 404 Not Found: Resource not found
  • 500 Internal Server Error: Server error

Error Response Format:

{
  "error": "Error message"
}

Usage Example

# List all QR codes
curl -H "X-API-Key: your_api_key_here" https://u2qr.com/api/v1/qrcodes

# Create a new QR code
curl -X POST \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "My Website",
    "type": "WEBSITE",
    "data": {
      "url": "https://example.com"
    }
  }' \
  https://u2qr.com/api/v1/qrcodes

# Get a specific QR code
curl -H "X-API-Key: your_api_key_here" https://u2qr.com/api/v1/qrcodes/abcd1234

# Update a QR code
curl -X PUT \
  -H "X-API-Key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "Updated Website",
    "type": "WEBSITE",
    "data": {
      "url": "https://updated-example.com"
    }
  }' \
  https://u2qr.com/api/v1/qrcodes/abcd1234

# Delete a QR code
curl -X DELETE \
  -H "X-API-Key: your_api_key_here" \
  https://u2qr.com/api/v1/qrcodes/abcd1234

Try QR Code Generator for 7 days free

Experience the power of U2QR with a free trial. No credit card required.

Start Free Trial