Registering an Available Wholesaler
Note
Part of the Wholesaler Integrations guide. See
Introduction first for the wholesaler OAuth
scope and the webhook delivery/signing mechanics referenced below.
This is the first step of the integration: without a registered
AvailableWholesaler, clinics cannot find or link you, and none of the
other endpoints in this guide will accept your token for a wholesaler that
doesn’t exist yet.
Note
Step 0, before any of this: your application itself must already be
registered as an integration — see Adding an Application in Provet. You can’t
obtain a wholesaler-scoped access token until that’s done. Consider
subscribing to the installation webhook described in
Get Notified for Installations of Your Applications in a Provet Organisation so you’re notified as soon as a clinic
installs your application, and can automate the rest of onboarding
(registering your AvailableWholesaler for them, etc.) from there.
Step 1 — Register an Available Wholesaler
An AvailableWholesaler lives in the clinic’s Provet database
and represents a wholesaler integration a specific clinic can later pick
from a list. In practice, you create or update this entry once your system
is registered as an integration with Provet.
# Create a new available wholesaler.
curl -X POST "https://[env.]provetcloud.com/<provet_id>/api/0.1/available_wholesaler/" \
-H "Authorization: Bearer <oauth_access_token>" \
-H "Content-Type: application/json" \
-d '{
"name": "Acme Veterinary Supplies",
"email": "orders@acmevet.example",
"register_number": "FI12345678",
"webhook_callback_url": "https://acmevet.example/webhooks/inbound",
"verification_salt": "your-shared-signing-secret"
}'
# List all registered available wholesalers.
curl "https://[env.]provetcloud.com/<provet_id>/api/0.1/available_wholesaler/" \
-H "Authorization: Bearer <oauth_access_token>"
# Retrieve one by ID.
curl "https://[env.]provetcloud.com/<provet_id>/api/0.1/available_wholesaler/<id>/" \
-H "Authorization: Bearer <oauth_access_token>"
# Update one (e.g. rotate verification_salt, or update webhook_callback_url).
curl -X PATCH "https://[env.]provetcloud.com/<provet_id>/api/0.1/available_wholesaler/<id>/" \
-H "Authorization: Bearer <oauth_access_token>" \
-H "Content-Type: application/json" \
-d '{"verification_salt": "your-new-shared-signing-secret"}'
# Delete one.
curl -X DELETE "https://[env.]provetcloud.com/<provet_id>/api/0.1/available_wholesaler/<id>/" \
-H "Authorization: Bearer <oauth_access_token>"
[env.] is the deployment the clinic lives on (e.g. us.,
enterprise., or omitted for the default environment).
The owning integration is always taken from your access token — a value sent in the request body is ignored, and creating one with a legacy API key instead of an OAuth 2.0 access token answers 401.
webhook_callback_url and verification_salt
webhook_callback_url must use HTTPS and point to a publicly
reachable host — private, loopback, and localhost addresses are
rejected with 400, since deliveries can carry decrypted credentials
(see Step 2 — Clinic connects the wholesaler).
verification_salt is the shared secret used to sign every webhook
delivered to that URL — see “Webhook signature verification” in
Introduction for the full scheme. In short:
Accepted on create and update, as a field on
available_wholesaler/.Required on create — a registration cannot be created without one.
Write-only — Provet never returns it on any response, so keep your own copy.
Updates take effect atomically for the next delivery, with no grace period, so rotation is coordinated from your side (see Introduction).
These records are later used in two places: clinic staff see them when
choosing a wholesaler to connect, and your system authenticates later
uploads against the registered AvailableWholesaler.
Step 2 — Clinic connects the wholesaler
This step is internal to Provet. Clinic staff pick your
wholesaler from a list in the UI and link it to their
AvailableWholesaler registration, from Stock > Inventory >
Wholesalers > Create Wholesaler, selecting “Integration” as the
wholesaler type — your available wholesaler is shown as one of the
options. See Add Wholesalers for the
customer-facing walkthrough of this screen, and Wholesalers in
Provet for how clinics manage
wholesalers more generally.
Once linked:
A
Wholesaleris created in the clinic’s database, pointing back at yourAvailableWholesaler.Provet
POSTs awholesaler.createdevent to yourwebhook_callback_url.
Use the wholesaler.id you receive as the wholesaler_pk for catalog
uploads (Making Products Available) and to correlate incoming
orders (Handling Orders).
wholesaler.created event reference
Provet POSTs this event to
available_wholesaler.webhook_callback_url when a clinic connects the
wholesaler. It only fires for API-managed wholesalers, so it
always describes a Wholesaler created from one of your
AvailableWholesaler registrations. Any field the clinic left blank is
sent as null.
{
"event": "wholesaler.created",
"event_id": "3f2504e0-4f89-41d3-9a0c-0305e82c3301",
"available_wholesaler": {
"id": 7,
"name": "Acme Veterinary Supplies",
"email": "orders@acmevet.example",
"register_number": "FI12345678"
},
"wholesaler": {
"id": 123,
"customer_number": "CLINIC-42",
"customer_username": "clinic42-login",
"customer_password": "s3cr3t",
"department": {"id": 4, "name": "Main Clinic"}
}
}
Field |
Type |
Optional |
Meaning |
|---|---|---|---|
|
string |
No |
Always |
|
string |
No |
UUID identifying this event. See deduplication rules. |
|
number |
No |
ID of your registered |
|
string |
No |
Name of that |
|
string / null |
Yes |
Contact email registered for the |
|
string / null |
Yes |
Business / registration number registered for the |
|
number |
No |
Per-clinic |
|
string / null |
Yes |
The clinic’s customer number with the wholesaler. |
|
string / null |
Yes |
Login / username the clinic entered for this wholesaler. |
|
string / null |
Yes |
Password the clinic entered, decrypted. Treat it as a secret. |
|
object / null |
Yes |
Set when credentials are specific to one clinic location; |
Note
name, email, and register_number live under
available_wholesaler because they describe the integration you
registered. For an integration wholesaler the clinic cannot edit them,
so they are not repeated on the wholesaler object.
Provet customers can choose to enable wholesalers globally in
their organization, or locally in specific clinic locations / departments.
The credential fields carry department-specific values when department
is present, otherwise the wholesaler-global values.
Errors specific to registration
Situation |
Response |
|---|---|
OAuth token invalid/expired |
401 |
Update / delete on an |
403 |
Creating an |
401 |
See the full error reference for errors that can occur across every phase of the integration.