POST
https://jmpy.me/api/v1
/
qr-codes
/
generate
Generate QR Code
curl --request POST \
  --url https://jmpy.me/api/v1/qr-codes/generate \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "content_type": "<string>",
  "content_data": {},
  "visual_settings": {
    "foregroundColor": "<string>",
    "backgroundColor": "<string>",
    "size": 123,
    "margin": 123,
    "errorCorrectionLevel": "<string>",
    "logoUrl": "<string>"
  },
  "is_dynamic": true,
  "tracking_enabled": true,
  "name": "<string>",
  "password": "<string>",
  "expires_at": "<string>",
  "expiration_date": "<string>",
  "source": "<string>",
  "logo": "<string>",
  "output_format": "<string>"
}
'
Generate a new QR code with various content types and visual customization options. Dynamic QR codes can have their destination changed later, while static QR codes encode the content directly.
Dynamic vs Static QR Codes
  • Dynamic: Creates a short URL that redirects to your content. You can change the destination later without reprinting the QR code.
  • Static: Encodes the content directly into the QR code. Cannot be changed after creation.
When is_dynamic or tracking_enabled is true, a short URL is automatically created for the QR code.

Body Parameters

content_type
string
required
Type of content to encode.Options: url, text, wifi, vcard, email, phone, sms, location
content_data
object
required
Content data object. Structure depends on content_type.
visual_settings
object
Visual customization options for the QR code appearance.
is_dynamic
boolean
default:false
Whether to create a dynamic QR code (destination can be changed later).When true, creates an associated short URL for redirection.
tracking_enabled
boolean
default:false
Whether to enable scan tracking and analytics.When true, creates an associated short URL for tracking scans. View analytics using the QR Analytics endpoints.
name
string
Friendly name for the QR code (for organization purposes).
password
string
Password to protect the QR code content. Users will be prompted to enter this password before accessing the destination.
expires_at
string
ISO 8601 timestamp when the QR code should expire.Example: 2024-12-31T23:59:59Z
expiration_date
string
Alternative to expires_at. ISO 8601 date string for expiration.
source
string
default:"QR_CODE_GENERATOR"
Source identifier for tracking.Options: QR_CODE_GENERATOR, BULK_IMPORT
Base64-encoded logo image to overlay on the QR code. Must start with data:image/.Example: data:image/png;base64,iVBORw0KGgo...
output_format
string
default:"image"
Response format for the generated QR code.Options:
  • image (default): Returns a ready-to-use PNG image in Native Image Block format
  • json: Returns raw JSON with base64-encoded image data
You can also use ?format=json query parameter instead of this body parameter.

Response Formats

The API supports two response formats. Most users should use the default PNG image format.
Best for: Most users who want a ready-to-use QR code image.The response contains a content array with:
  1. Image block: The actual PNG image data (ready to display/save)
  2. Text block: Metadata about the QR code (JSON)
{
  "content": [
    {
      "type": "image",
      "data": "iVBORw0KGgoAAAANSUhEUg...",  // Base64 PNG data
      "mimeType": "image/png"
    },
    {
      "type": "text",
      "text": "{\"success\":true,\"data\":{\"id\":\"...\",\"content\":\"...\"}}"
    }
  ]
}
The content[0].data contains pure base64 image data that can be directly decoded and saved as a PNG file or displayed in an <img> tag using: data:image/png;base64,${content[0].data}

Request Examples

curl -X POST "https://jmpy.me/api/v1/qr-codes/generate" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content_type": "url",
    "content_data": {
      "url": "https://example.com/landing-page"
    },
    "visual_settings": {
      "foregroundColor": "#1a1a1a",
      "backgroundColor": "#ffffff",
      "size": 400,
      "errorCorrectionLevel": "H"
    },
    "is_dynamic": true,
    "tracking_enabled": true,
    "name": "Product Launch QR"
  }'

Response Examples

{
  "success": true,
  "data": {
    "id": "770e8400-e29b-41d4-a716-446655440000",
    "content": "https://jmpy.me/xyz789",
    "original_content": "https://example.com/landing-page",
    "qr_code_data": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...",
    "dataURL": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg...",
    "content_type": "url",
    "content_data": {
      "url": "https://example.com/landing-page"
    },
    "visual_settings": {
      "foregroundColor": "#1a1a1a",
      "backgroundColor": "#ffffff",
      "size": 400,
      "errorCorrectionLevel": "H"
    },
    "is_dynamic": true,
    "tracking_enabled": true,
    "short_url_id": "550e8400-e29b-41d4-a716-446655440000",
    "name": "Product Launch QR",
    "expires_at": null,
    "is_temporary": false,
    "created_at": "2024-01-15T10:30:00.000Z"
  },
  "requestId": "qr_1705316000000_abc123xyz"
}

Use Cases

Generate a QR code that allows users to connect to a WiFi network by scanning.
const response = await fetch('https://jmpy.me/api/v1/qr-codes/generate', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    content_type: 'wifi',
    content_data: {
      ssid: 'GuestNetwork',
      password: 'welcome123',
      encryption: 'WPA'
    },
    visual_settings: {
      size: 300,
      foregroundColor: '#2563eb'
    },
    name: 'Office WiFi QR'
  })
});
Generate a QR code that adds contact information to a phone’s address book.
response = requests.post(
    'https://jmpy.me/api/v1/qr-codes/generate',
    headers={'Authorization': 'Bearer YOUR_API_KEY'},
    json={
        'content_type': 'vcard',
        'content_data': {
            'firstName': 'John',
            'lastName': 'Doe',
            'email': 'john.doe@company.com',
            'phone': '+1-555-123-4567',
            'organization': 'Acme Inc',
            'title': 'Sales Manager'
        },
        'name': 'John Doe Business Card'
    }
)
Create a QR code that requires a password before revealing the content.
curl -X POST "https://jmpy.me/api/v1/qr-codes/generate" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "content_type": "url",
    "content_data": {
      "url": "https://example.com/confidential-doc"
    },
    "password": "secret123",
    "name": "Confidential Document QR"
  }'