Contents
On this page

Export Batch - Plugixa PDF Vouchers for WooCommerce

GET /plugixa-pdf-vouchers/v1/bulk/export

Every voucher of a batch, with full codes, like Download CSV with the codes.

Needs a user with the plugixa_pdfv_export capability (signed in with an Application Password, or the login cookie with an X-WP-Nonce header). Administrators and shop managers get it when the plugin is activated; see Staff access.

Note. Pro only: on the free plugin this route answers 404 rest_no_route.

Request

GET https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/bulk/export?batch=bulk-261024-acme

Query parameters

Field Type Required Description
batch string Yes The batch name: lowercase letters, digits, _ and -, up to 40 characters.

Responses

200 OK. A CSV file named vouchers-<batch>.csv, not JSON.

Columns: code, amount, balance, currency, status, expires_at, recipient_email, recipient_name. Same CSV form as Export Report.

Errors

Status Code When
401 / 403 plugixa_pdfv_forbidden The caller lacks the capability.
400 rest_invalid_param batch is missing or not in the allowed form.

Plus the errors every endpoint can return.

Examples

curl -s "https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/bulk/export?batch=bulk-261024-acme" \
  -u "$WP_USER:$WP_APP_PASSWORD" \
  -o "vouchers-bulk-261024-acme.csv"
<?php
$ch = curl_init('https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/bulk/export?batch=bulk-261024-acme');
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_USERPWD        => getenv('WP_USER') . ':' . getenv('WP_APP_PASSWORD'),
]);
file_put_contents('vouchers-bulk-261024-acme.csv', curl_exec($ch));
curl_close($ch);
const response = await fetch('https://your-store.example/wp-json/plugixa-pdf-vouchers/v1/bulk/export?batch=bulk-261024-acme', {
  headers: {
    'Authorization': `Basic ${btoa(`${process.env.WP_USER}:${process.env.WP_APP_PASSWORD}`)}`,
  },
});
const { data } = await response.json();

Quick Links

Share