Skip to main content

Create a job from your system

When a repair order, warranty claim or booking arrives in your own system (a shop till, an ERP, a CRM), you can create the job in PartnerFlow straight away. Your team then sees it in Workshop › All jobs like any other, and can work it through the service's stages.

tip

Taking bookings from customers on your own website? Use Build your own website instead: it checks the booking against your booking steps and applies your intake rules, like your Help centre does.

Before you start​

  • An API key with services:read, customers:read, customers:write and service_records:write. See Authentication.
  • A service set up in PartnerFlow for this kind of work. See Services.

1. Find your service​

List your services and note the API name of the one jobs should go to. It's the short name used in the service's address in the app.

curl https://api.partner-flow.com/api/v3/service \
-H "Authorization: Bearer $PF_KEY"

To see the information a job on that service collects, read the service by name. Its fields are what you send when you create a job:

curl https://api.partner-flow.com/api/v3/service/by-name/workshop-repair \
-H "Authorization: Bearer $PF_KEY"

2. Find or create the customer​

Look the customer up by email or phone first, so you don't create a duplicate:

curl "https://api.partner-flow.com/api/v3/integrations/customer-record-lookup?email=sam@example.com" \
-H "Authorization: Bearer $PF_KEY"

If there's no match, create them. A customer needs an email or a phone number:

curl -X POST https://api.partner-flow.com/api/v3/customers \
-H "Authorization: Bearer $PF_KEY" \
-H "Content-Type: application/json" \
-d '{
"firstName": "Sam",
"lastName": "Patel",
"email": "sam@example.com",
"phone": "+447700900123",
"shippingAddress": { "street": "12 High Street", "city": "Leeds", "postcode": "LS1 4AB", "country": "GB" }
}'

Keep the id from the response.

3. Create the job​

Send the job's information in recordData. Use the customer's id as customerId, a short name your team will recognise, and the service's own fields by their API names. Set status to the name of the stage the job should start in, exactly as it appears in the service's journey.

curl -X POST https://api.partner-flow.com/api/v3/service-records/workshop-repair \
-H "Authorization: Bearer $PF_KEY" \
-H "Content-Type: application/json" \
-d '{
"recordData": {
"customerId": "3f6c2a1e-…",
"name": "Order 10482 – Northway Glide 5",
"status": "Collection",
"fault_description": "Front wheel wobbles"
}
}'

The response is the new job, including its id. It appears in Workshop › All jobs in the app straight away.

note

Always set status to a real stage name. A job created without one isn't in any stage of the journey, so your team has to move it by hand before it shows up in the right place.

4. Follow it​

  • Read one job: GET /service-records/{serviceApiName}/{recordId}.
  • List a service's jobs: GET /service-records/{serviceApiName}, or every job you can see with GET /jobs.
  • Read its history: GET /audit/service-record-activities.
  • Move it on: POST /service/by-name/{serviceName}/records/{id}/transition with the transitionId of the step to take. PartnerFlow checks the stage's requirements first and replies 400 with every unmet one by name, or 409 if the job has already moved.

5. Take a card payment (optional)​

When the job has a priced estimate, your own site can take the customer's card payment once they accept it. PartnerFlow doesn't email or message the customer for any of these calls: your site shows the link or redirects to it.

  1. Record the acceptance. PATCH /billing/transactions/{id}/status with {"status": "APPROVED"} approves every line, or add "approvedLineItemIds" to approve only the optional items the customer chose (required items are always approved). Needs Create and edit estimates (estimates:write).
  2. Get the pay link. POST /billing/transactions/{id}/pay-link with {} for the whole balance, or {"amount": "50.00"} for a deposit and "expiresInDays" (1 to 30, default 30). Needs Create payment links without emailing them (payment_links:create).
curl -X POST https://api.partner-flow.com/api/v3/billing/transactions/8d2e…/pay-link \
-H "Authorization: Bearer $PF_KEY" \
-H "Content-Type: application/json" \
-d '{"amount": "50.00"}'

The response has payUrl, paymentRequestId, amount, currencyCode, expiresAt and reused. Calling again for the same amount while that link is still unpaid and unexpired gives you the same link (reused: true), so a retry never makes a second one. When the customer pays, the payment is recorded on the job like any other card payment.

The link is refused with 409 when the estimate isn't accepted yet (NOT_APPROVED), nothing is owed (NOTHING_DUE) or you haven't connected Stripe (STRIPE_NOT_CONNECTED), and with 400 when the amount is more than what's owed (INVALID_AMOUNT) or the customer has no email for the Stripe receipt (NO_CUSTOMER_EMAIL). Another company's transaction is a 404.

note

POST /billing/transactions/{id}/request-payment is different: it emails the customer a pay link. Use pay-link when your site sends the customer to pay.