Images and multipart/form-data
Endpoints that accept an image (creating a coupon, event, transit, hotel or communication template, updating the wallet…) expect a multipart/form-data body. Each endpoint's reference page states the expected type.
Sending {"strip": "<PNG file>"} as application/json doesn't work. Use multipart/form-data, and let your HTTP client generate the Content-Type header (it contains the boundary).
The three multipart rules
- Files are file fields:
-F "strip=@strip.png;type=image/png". - Objects and arrays (
colors,security,locations,displayOptions,iosHeader,date…) are sent as JSON strings:-F 'colors={"backgroundColor":"#131313","labelColor":"#9EE00D","foregroundColor":"#FFFFFF"}' - Booleans are sent as the text
"true"or"false". Any other value counts asfalse.
- curl
- SDK Node.js
- nodejs
- php
- python
- java
- csharp
- go
- ruby
- CURL
curl -L 'https://api-v2.test.eldowallet.fr/coupons' \
-H 'Accept: application/json' \
-H 'x-lang: en' \
-H 'Authorization: Bearer <token>' \
-F 'strip=@"strip.png"' \
-F 'colors="{\"backgroundColor\":\"\#59358B\",\"labelColor\":\"\#F2FBCE\",\"foregroundColor\":\"\#FFFFFF\"}"' \
-F 'security="{\"enableOneTimeUse\":true}"'
File constraints
| Image formats | PNG or JPEG |
| Image size | 1 KB to 5 MB |
| CSV import | text/csv, 10 MB and 100,000 rows maximum |
| Per request | 10 files and 50 MB per file maximum |
An image outside these limits returns 400:VALIDATION_ERROR. A malformed multipart body returns 400:INVALID_MULTIPART, and an unsupported Content-Type returns 415:UNSUPPORTED_MEDIA_TYPE.
Updates
Most PATCH endpoints accept multipart or JSON. Use JSON when you aren't changing an image: it's simpler.
For recommended pass image dimensions, see the knowledge base.