{"openapi":"3.1.0","info":{"title":"TestSwap public swap discovery API","version":"1.0.0","description":"Read-only search of learner driving-test swap listings that their learners chose to publish, and a two-way compatibility check. Listings are entered by learners and are NOT verified with DVSA. Nothing is reserved or guaranteed; recheck on testswap.com before relying on a result. TestSwap is not part of DVSA. Swaps between more than two learners are not offered. Never assume a year: give dates as YYYY-MM-DD or YYYY-MM (or 'December 2026'); a month without a year is reported as missing."},"servers":[{"url":"https:\/\/testswap.com\/api\/v1"}],"paths":{"\/swap-listings":{"get":{"operationId":"searchSwapListings","summary":"Search current public swap listings","parameters":[{"name":"centre","in":"query","schema":{"type":"string"},"description":"Test centre held by the listing"},{"name":"from","in":"query","schema":{"type":"string"},"description":"Earliest test date held (YYYY-MM-DD or YYYY-MM)"},{"name":"to","in":"query","schema":{"type":"string"}},{"name":"page","in":"query","schema":{"type":"integer","minimum":1,"maximum":100}},{"name":"per_page","in":"query","schema":{"type":"integer","minimum":1,"maximum":50}}],"responses":{"200":{"description":"Listings","content":{"application\/json":{"schema":{"type":"object","properties":{"listings":{"type":"array","items":{"$ref":"#\/components\/schemas\/Listing"}},"total":{"type":"integer"},"page":{"type":"integer"},"per_page":{"type":"integer"},"generated_at":{"type":"string","format":"date-time"}}}}}},"422":{"description":"Unreadable or year-less date"},"429":{"description":"Rate limited"},"503":{"description":"Feature switched off"}}}},"\/swap-listings\/{publicId}":{"get":{"operationId":"getSwapListingStatus","summary":"Current status of one listing","parameters":[{"name":"publicId","in":"path","required":true,"schema":{"type":"string"}}],"responses":{"200":{"description":"status is active (listing included), needs_reconfirmation or no_longer_available (no details)","content":{"application\/json":{"schema":{"type":"object","properties":{"id":{"type":"string"},"status":{"type":"string","enum":["active","needs_reconfirmation","no_longer_available"]},"listing":{"oneOf":[{"$ref":"#\/components\/schemas\/Listing"},{"type":"null"}]},"generated_at":{"type":"string"}}}}}},"404":{"description":"Not found or no longer published"}}}},"\/reciprocal-matches":{"get":{"operationId":"findReciprocalMatches","summary":"Two-way compatibility check of the caller's test against current listings","parameters":[{"name":"has_centre","in":"query","schema":{"type":"string"},"description":"Centre of the test you hold"},{"name":"has_date","in":"query","schema":{"type":"string"},"description":"Date of the test you hold, with year"},{"name":"has_time","in":"query","schema":{"type":"string","pattern":"^\\d{2}:\\d{2}$"},"description":"Needed for the weekday vs evening\/weekend rule"},{"name":"want_centres","in":"query","schema":{"type":"string"},"description":"Comma-separated centres you would accept (default: your centre and its 3 nearest)"},{"name":"want_from","in":"query","required":true,"schema":{"type":"string"},"description":"Start of the dates you want, with year"},{"name":"want_to","in":"query","schema":{"type":"string"}},{"name":"want_time_of_day","in":"query","schema":{"type":"string","enum":["morning","afternoon"]}}],"responses":{"200":{"description":"result: potential_matches_found | relevant_listings_compatibility_unknown | no_current_match | needs_more_information. Each match has classification potential_match | compatibility_unknown | incompatible with checks (listing_meets_customer, customer_meets_listing, dvsa_rules: true\/false\/null), reasons and missing.","content":{"application\/json":{"schema":{"type":"object","properties":{"result":{"type":"string"},"matches":{"type":"array","items":{"type":"object","properties":{"listing":{"$ref":"#\/components\/schemas\/Listing"},"classification":{"type":"string","enum":["potential_match","compatibility_unknown","incompatible"]},"checks":{"type":"object"},"reasons":{"type":"array","items":{"type":"string"}},"missing":{"type":"array","items":{"type":"string"}},"requires_eligibility_check":{"type":"array","items":{"type":"string"}}}}},"missing":{"type":"array","items":{"type":"string"}},"notes":{"type":"array","items":{"type":"string"}},"chains":{"type":"string","enum":["not_offered"]},"rules":{"type":"object"},"disclaimer":{"type":"string"},"generated_at":{"type":"string"}}}}}}}}},"\/test-centres\/resolve":{"get":{"operationId":"resolveTestCentre","summary":"Resolve a typed centre name to a DVSA test centre","parameters":[{"name":"q","in":"query","required":true,"schema":{"type":"string","minLength":2}}],"responses":{"200":{"description":"resolved is null when ambiguous; choose from candidates"}}}}},"components":{"schemas":{"Listing":{"type":"object","properties":{"id":{"type":"string","description":"Opaque public listing id"},"has":{"type":"object","properties":{"centre":{"type":"string"},"date":{"type":"string","format":"date"},"time":{"type":["string","null"],"example":"10:14"},"booking_type":{"type":"string","enum":["weekday","evening_weekend_bank_holiday"]},"source":{"type":"string","enum":["learner_reported"]}}},"wants":{"type":"object","properties":{"date_windows":{"type":"array","items":{"type":"object","properties":{"from":{"type":"string","format":"date"},"to":{"type":"string","format":"date"}}}},"centres":{"type":"array","items":{"type":"string"},"description":"Centres DVSA allows this booking to swap to (same centre or one of the 3 nearest; straight-line approximation)"},"preferred_centre":{"type":["string","null"]},"time_of_day":{"type":["string","null"],"enum":["morning","afternoon",null]}}},"status":{"type":"string","enum":["active"]},"learner_confirmed_at":{"type":"string","format":"date-time"},"verification":{"type":"object","properties":{"method":{"type":"string","enum":["learner_reported"]},"verified_at":{"type":["string","null"]},"note":{"type":"string"}}},"expires_at":{"type":["string","null"],"format":"date-time"},"page_updated_at":{"type":["string","null"],"format":"date-time"},"url":{"type":"string","format":"uri"}}}}}}