Submit a Job with Images


Below are some examples of how to send a job request with images attached. For guidance on how to create a valid signature for each request, please see these instructions.

NOTE: All examples use a test endpoint (prefixed with /verify) that will not create any data. Please use this for endpoint while testing your implementation.

Endpoint

POST /jobs/with-attachments

Authentication

Requires affiliate client authentication see (link here).

Request Format

Content-Type: multipart/form-data

Fields

  • data (required): JSON string containing job details
  • images (optional): Up to 5 image files (JPEG, PNG, etc.)

Data JSON Structure

{
  "description": "Need bathroom tiling completed",
  "categoryId": "12345",
  "email": "[email protected]",
  "firstName": "John",
  "lastName": "Smith",
  "phone": "+447712345678",
  "address": {
    "line1": "123 High Street",
    "city": "London"
  },
  "postcode": "SW1A 1AA",
  "preferredStart": {
    "id": "WITHIN_2_WEEKS"
  }
}

Example Request with Images

cURL

curl -X POST https://api.checkatrade.com/v1/affiliate-job/verify/jobs/with-attachments \
  -H "Authorization: <HMAC-signature>" \
  -F 'data={"description":"Bathroom tiling needed","categoryId":"12345","email":"[email protected]","firstName":"John","lastName":"Smith","phone":"+447712345678","postcode":"SW1A 1AA","preferredStart":{"id":"WITHIN_2_WEEKS"}}' \
  -F '[email protected]' \
  -F '[email protected]'

JavaScript (Fetch API)

const formData = new FormData();

// Add job data
const jobData = {
  description: "Bathroom tiling needed",
  categoryId: "12345",
  email: "[email protected]",
  firstName: "John",
  lastName: "Smith",
  phone: "+447712345678",
  postcode: "SW1A 1AA",
  preferredStart: {
    id: "WITHIN_2_WEEKS"
  }
};
formData.append('data', JSON.stringify(jobData));

// Add images
const fileInput = document.querySelector('input[type="file"]');
for (const file of fileInput.files) {
  formData.append('images', file);
}

const response = await fetch('https://api.checkatrade.com/v1/affiliate-job/verify/jobs/with-attachments', {
  method: 'POST',
  headers: {
    'Authorization': '<HMAC-signature>'
  },
  body: formData
});

const result = await response.json();

Node.js

import { readFileSync } from 'fs';

const formData = new FormData();

// Add job data
const jobData = {
  description: "Bathroom tiling needed",
  categoryId: "12345",
  email: "[email protected]",
  firstName: "John",
  lastName: "Smith",
  phone: "+447712345678",
  postcode: "SW1A 1AA",
  preferredStart: {
    id: "WITHIN_2_WEEKS"
  }
};
formData.append('data', JSON.stringify(jobData));

// Add images
const photo1 = readFileSync('bathroom-photo1.jpg');
const photo2 = readFileSync('bathroom-photo2.jpg');

formData.append('images', new Blob([photo1], { type: 'image/jpeg' }), 'bathroom-photo1.jpg');
formData.append('images', new Blob([photo2], { type: 'image/jpeg' }), 'bathroom-photo2.jpg');

const response = await fetch('https://api.checkatrade.com/v1/affiliate-job/verify/jobs/with-attachments', {
  method: 'POST',
  headers: {
    'Authorization': '<HMAC-signature>'
  },
  body: formData
});

Response

Status: 201 Created

{
	"id": "<uuid>",
  "trades": [
    {
      "id": 1052403,
      "name": "PPL Company 5",
      "profileURL": "https://www.checkatrade.com/trades/pplcompany5"
    },
    // ...remaining trades
	]
}

Test Response

NOTE: When testing with the /verify/... endpoint, the shape of the response differs, instead returning a breakdown of the data submitted along with the trades found for the query:

{
    "body": {
        "categoryId": 20,
        "description": "Bathroom tiling needed",
        "postcode": "SW1A 1AA",
        "creationSource": "Affiliate "
    },
    "headers": {},
    "consumer": {
        "email": "[email protected]",
        "firstName": "John",
        "lastName": "Doe",
        "phone": "+447712345678"
    },
    "foundTrades": [
        {
            "companyId": 1052403,
            "name": "PPL Company 5"
        },
        {
            "companyId": 1052397,
            "name": "PPL Company 2"
        }
    ],
    "images": [
      "bathroom-photo1.jpg",
			"bathroom-photo2.jpg"
    ]
}