Card API
Generate customizable card SVGs with glyphs
/api/v1/card/svg Available/api/v1/card/png AvailablePlayground
Test the Card API in real-time by editing the URL below. The card will update automatically as you type.
Quick Presets:
Description
The Card API generates card SVGs with embedded glyphs. Cards have standard dimensions (51.5mm × 81mm by default) and include colorization by default. This endpoint is perfect for creating printable cards with custom glyph content.
Default Values
- colorized:
true - cardWidth:
51.5mm - cardHeight:
81mm
Parameters
| Parameter | Type | Required | Description | Example |
|---|---|---|---|---|
duod | string | ❌ | Glyph identifier (0-9, A-B) | 0, 5, A |
height | number | ❌ | Height value for the glyph | 100 |
border | number | ❌ | Border width | 5 |
thiccness | number | ❌ | Thickness of glyph elements | 10 |
bar | JSON array | ❌ | Fraction array for bar elements | [1,2] |
color | string | ❌ | Primary color (CSS color) | blue, #FF0000 |
fill | JSON array | ❌ | Fill colors array | ["red", "blue"] |
viewBox | string | ❌ | SVG viewBox attribute | 0 0 100 100 |
colorized | boolean | ❌ | Enable colorization (default: true) | true, false |
svgW | string | ❌ | SVG width attribute | 200 |
svgH | string | ❌ | SVG height attribute | 200 |
borderColor | string | ❌ | Border color (CSS color) | black, #000000 |
backgroundColor | string | ❌ | Background color (CSS color) | white, #FFFFFF |
Response
Headers
Content-Type: image/svg+xml
Cache-Control: public, max-age=31536000, immutable Body
Valid SVG markup representing the generated card with embedded glyph
Examples
Basic Card
GET /api/v1/card/svg?duod=0 Card with Specific Glyph
GET /api/v1/card/svg?duod=5 Card with Custom Color
GET /api/v1/card/svg?duod=A&color=red Card without Colorization
GET /api/v1/card/svg?duod=7&colorized=false Card with Complex Parameters
GET /api/v1/card/svg?duod=B&height=120&border=3&thiccness=12&color=blue&backgroundColor=lightgray Card Dimensions
By default, cards are sized to standard playing card dimensions:
- Width: 51.5mm (poker card width)
- Height: 81mm (poker card height)
- Aspect Ratio: ~1.57:1
These dimensions make the cards suitable for printing and physical use.
Usage in HTML
Cards can be embedded directly in HTML:
<img src="/api/v1/card/svg?duod=5&color=blue" alt="Card" /> For responsive design, you can control the display size with CSS:
img.card {
width: 100%;
max-width: 200px;
height: auto;
}Print Considerations
Cards are designed with print production in mind:
- Vector format: SVG scales perfectly for high-resolution printing
- Standard dimensions: Compatible with card printing services
- Color support: Full color customization for branding
- Consistent sizing: All cards maintain the same dimensions
Error Handling
The API handles invalid parameters gracefully:
- Invalid JSON in
barorfillparameters will be ignored - Invalid colors will fall back to default values
- Invalid numeric values will be ignored
- Unknown parameters are ignored
- Invalid
colorizedvalues default totrue
PNG Endpoint
PNG endpoints accept all the same parameters as SVG endpoints, plus additional PNG-specific options:
- scale - Scale factor for higher resolution (e.g., scale=2 for 2x resolution)
- pngWidth - Target width in pixels
- pngHeight - Target height in pixels
- pngBackground - Background color (supports transparent, white, #FF0000, etc.)
PNG endpoints are perfect for:
- Social media sharing
- Email newsletters
- Applications that don't support SVG
- Thumbnail generation
- High-resolution printing
PNG Example
GET /api/v1/card/png?duod=5&scale=2&pngBackground=white