Contents
On this page

Upload a File - Plugixa Extra Product Options

POST /plugixa-epo/v1/uploads

The product page sends a customer’s file here as soon as it is chosen, and gets a token back; the add-to-cart form then submits only the token. You do not need this route to manage your store: it is listed so you know what the product page calls. See File uploads.

Public: no sign-in. The route protects itself instead, as described below. Pro only: on the free plugin this route answers 404 rest_no_route.

Note. The request must carry the X-Pepo-Nonce header the product page prints with the form, and the field must belong to a published group. A visitor can upload at most 30 files in 10 minutes.

Request

POST https://your-store.example/wp-json/plugixa-epo/v1/uploads

Request body

Content type: multipart/form-data, not JSON.

Field Type Required Description
file file Yes The file.
group integer Yes The group’s id.
field string Yes The upload field’s id.

Responses

201 Created.

{
  "success": true,
  "data": {
    "token": "Qm1x7Tz0aP4kWn8sR2vY",
    "name": "family-photo.jpg",
    "size": "2 MB"
  }
}
Field Type Meaning
token string What the form submits for the field
name string The file’s original name
size string Its size, for display

Errors

Status Code When
403 plugixa_epo_upload_nonce The nonce is missing or expired: This page has expired. Please reload it and try again.
429 plugixa_epo_upload_rate Too many uploads. Please wait a few minutes.
404 plugixa_epo_upload_field The field is not an upload field of a published group: This upload is not available.
400 plugixa_epo_upload_missing No file was received.
413 plugixa_epo_upload_size The file is too large. The limit is 5 MB.
415 plugixa_epo_upload_type The extension or the real content is not allowed: This type of file is not accepted here. Allowed: JPG, PNG, PDF.

Plus the errors every endpoint can return.

Quick Links

Share