@ideal-postcodes/sdk 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (43) hide show
  1. package/LICENSE +1 -23
  2. package/README.md +16 -18
  3. package/dist/autocomplete.cjs +1 -146
  4. package/dist/autocomplete.d.cts +26 -14
  5. package/dist/autocomplete.d.ts +26 -14
  6. package/dist/autocomplete.mjs +1 -146
  7. package/dist/chunk-BNT2VR2B.mjs +6 -0
  8. package/dist/chunk-HQKXKJXR.cjs +6 -0
  9. package/dist/chunk-OHO6PZYM.mjs +1 -0
  10. package/dist/chunk-UO7BIPJH.cjs +1 -0
  11. package/dist/index.cjs +1 -76
  12. package/dist/index.d-BuZcXRMe.d.cts +45 -0
  13. package/dist/index.d-BuZcXRMe.d.ts +45 -0
  14. package/dist/index.d.cts +6 -12
  15. package/dist/index.d.ts +6 -12
  16. package/dist/index.mjs +1 -76
  17. package/dist/preact-query.cjs +1 -497
  18. package/dist/preact-query.d.cts +379 -123
  19. package/dist/preact-query.d.ts +379 -123
  20. package/dist/preact-query.mjs +1 -497
  21. package/dist/react-query.cjs +1 -497
  22. package/dist/react-query.d.cts +378 -122
  23. package/dist/react-query.d.ts +378 -122
  24. package/dist/react-query.mjs +1 -497
  25. package/dist/sdk.gen-C6G6f1JU.d.ts +420 -0
  26. package/dist/sdk.gen-CMX5dsNg.d.cts +420 -0
  27. package/dist/{types.gen-l7tYP1ZJ.d.cts → types.gen-Dmx_l_fj.d.cts} +4612 -2685
  28. package/dist/{types.gen-l7tYP1ZJ.d.ts → types.gen-Dmx_l_fj.d.ts} +4612 -2685
  29. package/package.json +71 -38
  30. package/dist/autocomplete.cjs.map +0 -1
  31. package/dist/autocomplete.mjs.map +0 -1
  32. package/dist/chunk-AVMJGCHZ.mjs +0 -913
  33. package/dist/chunk-AVMJGCHZ.mjs.map +0 -1
  34. package/dist/chunk-ZZUZHG5D.cjs +0 -913
  35. package/dist/chunk-ZZUZHG5D.cjs.map +0 -1
  36. package/dist/index.cjs.map +0 -1
  37. package/dist/index.mjs.map +0 -1
  38. package/dist/preact-query.cjs.map +0 -1
  39. package/dist/preact-query.mjs.map +0 -1
  40. package/dist/react-query.cjs.map +0 -1
  41. package/dist/react-query.mjs.map +0 -1
  42. package/dist/sdk.gen-C45EbTVQ.d.cts +0 -302
  43. package/dist/sdk.gen-_z1PNdoT.d.ts +0 -302
@@ -1,7 +1,8 @@
1
+ import type { dataTagSymbol, dataTagErrorSymbol } from "@tanstack/react-query";
1
2
  import * as _tanstack_react_query from '@tanstack/react-query';
2
- import { InfiniteData, UseMutationOptions } from '@tanstack/react-query';
3
- import { cl as PostcodesData, bN as PostcodeResponse, cn as PostcodesError, cq as KeyAvailabilityData, bH as ApiKeyResponse, f as ErrorResponse, cv as KeyDetailsData, bx as ApiKeyDetailsResponse, cA as UpdateKeyDetailsData, cE as UpdateKeyDetailsResponse, cC as UpdateKeyDetailsError, cF as KeyUsageData, bu as ApiKeyUsageResponse, bM as BadRequestResponse, cK as KeyLogsData, cP as AddressCleanseData, cT as AddressCleanseResponse, cR as AddressCleanseError, cU as FindAddressData, bl as AutocompleteResponse, cZ as ResolveAddressData, bj as GbrResolveAddressResponse, d2 as FindPlaceData, u as PlaceResponse, d7 as ResolvePlaceData, R as ResolvePlaceResponse, dc as ListLicenseesData, m as LicenseesResponse, dh as CreateLicenseeData, dl as CreateLicenseeResponse, dj as CreateLicenseeError, dm as DeleteLicenseeData, dr as DeleteLicenseeResponse, dp as DeleteLicenseeError, ds as RetrieveLicenseeData, L as LicenseeResponse, dx as UpdateLicenseeData, dB as UpdateLicenseeResponse, dz as UpdateLicenseeError, dC as ListConfigsData, j as ConfigsResponse, dE as ListConfigsError, dH as CreateConfigData, dL as CreateConfigResponse, dJ as CreateConfigError, dM as DeleteConfigData, dQ as DeleteConfigResponse, dO as DeleteConfigError, dR as RetrieveConfigData, g as ConfigResponse, dT as RetrieveConfigError, dW as UpdateConfigData, d_ as UpdateConfigResponse, dY as UpdateConfigError, d$ as EmailValidationData, E as EmailResponse, e1 as EmailValidationError, e4 as PhoneNumberValidationData, P as PhoneNumberResponse, e6 as PhoneNumberValidationError } from './types.gen-l7tYP1ZJ.cjs';
4
- import { O as Options } from './sdk.gen-C45EbTVQ.cjs';
3
+ import { UseMutationOptions, InfiniteData } from '@tanstack/react-query';
4
+ import { d as AddressCleanseData, g as AddressCleanseResponse, e as AddressCleanseError, n as AddressesData, l as AddressResponse, o as AddressesError, am as CreateConfigData, ap as CreateConfigResponse, an as CreateConfigError, ar as CreateLicenseeData, au as CreateLicenseeResponse, as as CreateLicenseeError, ay as DeleteConfigData, aB as DeleteConfigResponse, az as DeleteConfigError, aD as DeleteLicenseeData, aG as DeleteLicenseeResponse, aE as DeleteLicenseeError, aO as EmailValidationData, aN as EmailResponse, aU as ErrorResponse, F as FindAddressData, K as AutocompleteResponse, aZ as FindPlaceData, cg as PlaceResponse, bf as KeyAvailabilityData, I as ApiKeyResponse, bk as KeyDetailsData, z as ApiKeyDetailsResponse, bp as KeyLogsData, bu as KeyUsageData, J as ApiKeyUsageResponse, bJ as ListConfigsData, ae as ConfigsResponse, bO as ListLicenseesData, bH as LicenseesResponse, c6 as PhoneNumberValidationData, c5 as PhoneNumberResponse, ct as PostcodesData, cq as PostcodeResponse, cu as PostcodesError, cy as RegenerateLicenseeKeyData, cB as RegenerateLicenseeKeyResponse, cz as RegenerateLicenseeKeyError, cD as ResolveAddressData, b5 as GbrResolveAddressResponse, cH as ResolvePlaceData, cK as ResolvePlaceResponse, cN as RetrieveConfigData, ac as ConfigResponse, cO as RetrieveConfigError, cS as RetrieveLicenseeData, bG as LicenseeResponse, d4 as UpdateConfigData, d7 as UpdateConfigResponse, d5 as UpdateConfigError, d9 as UpdateKeyDetailsData, dc as UpdateKeyDetailsResponse, da as UpdateKeyDetailsError, de as UpdateLicenseeData, dh as UpdateLicenseeResponse, df as UpdateLicenseeError } from './types.gen-Dmx_l_fj.cjs';
5
+ import { O as Options } from './sdk.gen-CMX5dsNg.cjs';
5
6
 
6
7
  type QueryKey<TOptions extends Options> = [
7
8
  Pick<TOptions, "baseUrl" | "body" | "headers" | "path" | "query"> & {
@@ -20,11 +21,19 @@ declare const postcodesQueryKey: (options: Options<PostcodesData>) => [Pick<Opti
20
21
  *
21
22
  * Returns the complete list of addresses for a postcode. Postcode searches are space and case insensitive.
22
23
  *
23
- * The Postcode Lookup API provides a JSON interface to search UK addresses from a postcode. It can be used to power Postcode Lookup driven address searches, like [Postcode Lookup](/docs/postcode-lookup/).
24
+ * Each request looks up one postcode. To extract the addresses for several postcodes, send one request per postcode.
25
+ *
26
+ * Use it to power postcode driven address searches, like [Postcode Lookup](/docs/postcode-lookup/).
27
+ *
28
+ * Postcode lookup covers the United Kingdom, the Republic of Ireland, the Netherlands and Singapore. The API detects the format of the postcode you submit. UK and Irish postcodes are searched by default. For a Dutch or Singapore postcode, set `context` to `NLD` or `SGP`, or to `GLOBAL` to accept any supported format.
29
+ *
30
+ * UK postcodes need PAF, Multiple Residence, Not Yet Built, PAF Alias, PAF Welsh, AddressBase or AddressBase Premium on your key. Eircodes need ECAD or ECAF. Dutch postcodes need Kadaster. Singapore postcodes need HERE Asia Pacific. Without a matching licence the request is rejected.
31
+ *
32
+ * An unfound postcode costs no lookup. A postcode that returns addresses costs one.
24
33
  *
25
34
  * ## Postcode Not Found
26
35
  *
27
- * Lookup balance is unaffected by invalid postcodes. The API returns a `404` response with response body:
36
+ * Invalid postcodes do not affect your lookup balance. The API returns a `404` response with this body:
28
37
  *
29
38
  * ```json
30
39
  * {
@@ -36,15 +45,24 @@ declare const postcodesQueryKey: (options: Options<PostcodesData>) => [Pick<Opti
36
45
  *
37
46
  * ### Suggestions
38
47
  *
39
- * If a postcode cannot be found, the API will provide up to 5 closest matching postcodes. Common errors will be corrected first (e.g. mixing up `O` and `0` or `I` and `1`).
48
+ * If a postcode cannot be found, the API returns up to 5 of the closest matching postcodes. It corrects common errors first (e.g. mixing up `O` and `0` or `I` and `1`).
40
49
  *
41
- * If the suggestion list is small (fewer than 3), there is a high probability the correct postcode is there. You may notify the user or immediately trigger new searches.
50
+ * If the suggestion list is small (fewer than 3), the correct postcode is likely to be among them. Notify the user or trigger new searches immediately.
42
51
  *
43
- * The suggestion list will be empty if the postcode has deviated too far from a valid postcode format.
52
+ * The suggestion list is empty if the postcode has deviated too far from a valid postcode format.
44
53
  *
45
54
  * ## Multiple Residence
46
55
  *
47
- * A small number of postcodes will return more than 100 premises. These may require pagination. Use `page` to paginate the result set.
56
+ * A small number of postcodes return more than 100 premises. The API returns 100 addresses per page, so use `page` to paginate the result set.
57
+ *
58
+ * ## Testing
59
+ *
60
+ * - **ID1 1QD** Returns a successful postcode lookup response `2000`
61
+ * - **ID1 KFA** Returns "postcode not found" error `4040`
62
+ * - **ID1 CLIP** Returns "no lookups remaining" error `4020`
63
+ * - **ID1 CHOP** Returns "daily (or individual) lookup limit breached" error `4021`
64
+ *
65
+ * Test requests undergo the usual authentication and restriction rules. They surface any issues during implementation and do not cost you a lookup.
48
66
  *
49
67
  */
50
68
  declare const postcodesOptions: (options: Options<PostcodesData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<PostcodeResponse, PostcodesError, PostcodeResponse, [Pick<Options<PostcodesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
@@ -73,11 +91,19 @@ declare const postcodesInfiniteQueryKey: (options: Options<PostcodesData>) => Qu
73
91
  *
74
92
  * Returns the complete list of addresses for a postcode. Postcode searches are space and case insensitive.
75
93
  *
76
- * The Postcode Lookup API provides a JSON interface to search UK addresses from a postcode. It can be used to power Postcode Lookup driven address searches, like [Postcode Lookup](/docs/postcode-lookup/).
94
+ * Each request looks up one postcode. To extract the addresses for several postcodes, send one request per postcode.
95
+ *
96
+ * Use it to power postcode driven address searches, like [Postcode Lookup](/docs/postcode-lookup/).
97
+ *
98
+ * Postcode lookup covers the United Kingdom, the Republic of Ireland, the Netherlands and Singapore. The API detects the format of the postcode you submit. UK and Irish postcodes are searched by default. For a Dutch or Singapore postcode, set `context` to `NLD` or `SGP`, or to `GLOBAL` to accept any supported format.
99
+ *
100
+ * UK postcodes need PAF, Multiple Residence, Not Yet Built, PAF Alias, PAF Welsh, AddressBase or AddressBase Premium on your key. Eircodes need ECAD or ECAF. Dutch postcodes need Kadaster. Singapore postcodes need HERE Asia Pacific. Without a matching licence the request is rejected.
101
+ *
102
+ * An unfound postcode costs no lookup. A postcode that returns addresses costs one.
77
103
  *
78
104
  * ## Postcode Not Found
79
105
  *
80
- * Lookup balance is unaffected by invalid postcodes. The API returns a `404` response with response body:
106
+ * Invalid postcodes do not affect your lookup balance. The API returns a `404` response with this body:
81
107
  *
82
108
  * ```json
83
109
  * {
@@ -89,15 +115,24 @@ declare const postcodesInfiniteQueryKey: (options: Options<PostcodesData>) => Qu
89
115
  *
90
116
  * ### Suggestions
91
117
  *
92
- * If a postcode cannot be found, the API will provide up to 5 closest matching postcodes. Common errors will be corrected first (e.g. mixing up `O` and `0` or `I` and `1`).
118
+ * If a postcode cannot be found, the API returns up to 5 of the closest matching postcodes. It corrects common errors first (e.g. mixing up `O` and `0` or `I` and `1`).
93
119
  *
94
- * If the suggestion list is small (fewer than 3), there is a high probability the correct postcode is there. You may notify the user or immediately trigger new searches.
120
+ * If the suggestion list is small (fewer than 3), the correct postcode is likely to be among them. Notify the user or trigger new searches immediately.
95
121
  *
96
- * The suggestion list will be empty if the postcode has deviated too far from a valid postcode format.
122
+ * The suggestion list is empty if the postcode has deviated too far from a valid postcode format.
97
123
  *
98
124
  * ## Multiple Residence
99
125
  *
100
- * A small number of postcodes will return more than 100 premises. These may require pagination. Use `page` to paginate the result set.
126
+ * A small number of postcodes return more than 100 premises. The API returns 100 addresses per page, so use `page` to paginate the result set.
127
+ *
128
+ * ## Testing
129
+ *
130
+ * - **ID1 1QD** Returns a successful postcode lookup response `2000`
131
+ * - **ID1 KFA** Returns "postcode not found" error `4040`
132
+ * - **ID1 CLIP** Returns "no lookups remaining" error `4020`
133
+ * - **ID1 CHOP** Returns "daily (or individual) lookup limit breached" error `4021`
134
+ *
135
+ * Test requests undergo the usual authentication and restriction rules. They surface any issues during implementation and do not cost you a lookup.
101
136
  *
102
137
  */
103
138
  declare const postcodesInfiniteOptions: (options: Options<PostcodesData>) => _tanstack_react_query.UseInfiniteQueryOptions<PostcodeResponse, PostcodesError, InfiniteData<PostcodeResponse, unknown>, QueryKey<Options<PostcodesData>>, number | Pick<Pick<Options<PostcodesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
@@ -128,14 +163,13 @@ declare const keyAvailabilityQueryKey: (options: Options<KeyAvailabilityData>) =
128
163
  /**
129
164
  * Availability
130
165
  *
131
- * Returns public information on your API Key.
166
+ * Returns public information on an API Key: whether it can be used right now (`available`), the search contexts the key is licensed for (`contexts`) and the context that best matches the caller's IP address (`context`).
167
+ *
168
+ * The endpoint accepts API Keys (beginning `ak_`) and sub-licensed keys (beginning `sl_`), and needs no `user_token`.
132
169
  *
133
- * This endpoint can be used for the following:
134
- * - Determine if the key is currently usable via the `available` property
135
- * - Determine available contexts for an API Key
136
- * - Identify the currently likely context of a user given their location
170
+ * A key that exists but cannot be used, because it has no lookups left or has breached a limit, returns `200` with `"available": false`. An unknown or malformed key returns an error.
137
171
  *
138
- * You may pass both API Keys (beginning `ak_`) and Sub-licensed Keys (beginning `sl_`).
172
+ * Supply a valid `user_token` and the endpoint returns the key's private details instead, as `GET /keys/{key}/details` does. A `user_token` that does not own the key is rejected.
139
173
  *
140
174
  */
141
175
  declare const keyAvailabilityOptions: (options: Options<KeyAvailabilityData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ApiKeyResponse, ErrorResponse, ApiKeyResponse, [Pick<Options<KeyAvailabilityData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
@@ -166,8 +200,7 @@ declare const keyDetailsQueryKey: (options: Options<KeyDetailsData>) => [Pick<Op
166
200
  /**
167
201
  * Details
168
202
  *
169
- * Returns private data on the key including remaining lookups, available datasets and usage limits.
170
- *
203
+ * Returns private data on a key: remaining lookups, licensed datasets, usage limits, notification settings and the search contexts the key can serve.
171
204
  */
172
205
  declare const keyDetailsOptions: (options: Options<KeyDetailsData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ApiKeyDetailsResponse, ErrorResponse, ApiKeyDetailsResponse, [Pick<Options<KeyDetailsData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
173
206
  _id: string;
@@ -192,7 +225,7 @@ declare const keyDetailsOptions: (options: Options<KeyDetailsData>) => _tanstack
192
225
  /**
193
226
  * Update Details
194
227
  *
195
- * Update API Key Details
228
+ * Updates a key's settings and returns its private details. Only the fields you send change. A key on an unlimited plan ignores changes to `datasets`, `daily_limit` and `monthly_limit`.
196
229
  */
197
230
  declare const updateKeyDetailsMutation: (options?: Partial<Options<UpdateKeyDetailsData>>) => UseMutationOptions<UpdateKeyDetailsResponse, UpdateKeyDetailsError, Options<UpdateKeyDetailsData>>;
198
231
  declare const keyUsageQueryKey: (options: Options<KeyUsageData>) => [Pick<Options<KeyUsageData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
@@ -203,18 +236,14 @@ declare const keyUsageQueryKey: (options: Options<KeyUsageData>) => [Pick<Option
203
236
  /**
204
237
  * Usage Stats
205
238
  *
206
- * Reports the number of lookups consumed on a key for a range of days.
207
- *
208
- * A maximum interval of 90 days can be provided for analysis. If no start or end date is provided, the last 21 days will be used as the default interval.
209
- *
210
- * If no `start` time is provided, the start time will be set to 21 days prior to the current time.
239
+ * Reports the number of lookups a key consumed over a date range, as a total and a daily breakdown.
211
240
  *
212
- * If no `end` time is provided, the current time will be used.
241
+ * The range defaults to the last 21 days. `start` and `end` take UNIX timestamps in milliseconds, and `end` defaults to the current time. The maximum range is 90 days.
213
242
  *
214
- * Append `tags` to scope the number of lookups to those with matching tag values. E.g. `tags=foo,bar` will only count transactions that match `foo` and `bar`.
243
+ * Query at most three tags at once.
215
244
  *
216
245
  */
217
- declare const keyUsageOptions: (options: Options<KeyUsageData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ApiKeyUsageResponse, BadRequestResponse, ApiKeyUsageResponse, [Pick<Options<KeyUsageData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
246
+ declare const keyUsageOptions: (options: Options<KeyUsageData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ApiKeyUsageResponse, ErrorResponse, ApiKeyUsageResponse, [Pick<Options<KeyUsageData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
218
247
  _id: string;
219
248
  _infinite?: boolean;
220
249
  tags?: ReadonlyArray<string>;
@@ -231,25 +260,21 @@ declare const keyUsageOptions: (options: Options<KeyUsageData>) => _tanstack_rea
231
260
  tags?: ReadonlyArray<string>;
232
261
  }] & {
233
262
  [dataTagSymbol]: ApiKeyUsageResponse;
234
- [dataTagErrorSymbol]: BadRequestResponse;
263
+ [dataTagErrorSymbol]: ErrorResponse;
235
264
  };
236
265
  };
237
266
  declare const keyUsageInfiniteQueryKey: (options: Options<KeyUsageData>) => QueryKey<Options<KeyUsageData>>;
238
267
  /**
239
268
  * Usage Stats
240
269
  *
241
- * Reports the number of lookups consumed on a key for a range of days.
242
- *
243
- * A maximum interval of 90 days can be provided for analysis. If no start or end date is provided, the last 21 days will be used as the default interval.
270
+ * Reports the number of lookups a key consumed over a date range, as a total and a daily breakdown.
244
271
  *
245
- * If no `start` time is provided, the start time will be set to 21 days prior to the current time.
272
+ * The range defaults to the last 21 days. `start` and `end` take UNIX timestamps in milliseconds, and `end` defaults to the current time. The maximum range is 90 days.
246
273
  *
247
- * If no `end` time is provided, the current time will be used.
248
- *
249
- * Append `tags` to scope the number of lookups to those with matching tag values. E.g. `tags=foo,bar` will only count transactions that match `foo` and `bar`.
274
+ * Query at most three tags at once.
250
275
  *
251
276
  */
252
- declare const keyUsageInfiniteOptions: (options: Options<KeyUsageData>) => _tanstack_react_query.UseInfiniteQueryOptions<ApiKeyUsageResponse, BadRequestResponse, InfiniteData<ApiKeyUsageResponse, unknown>, QueryKey<Options<KeyUsageData>>, number | Pick<Pick<Options<KeyUsageData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
277
+ declare const keyUsageInfiniteOptions: (options: Options<KeyUsageData>) => _tanstack_react_query.UseInfiniteQueryOptions<ApiKeyUsageResponse, ErrorResponse, InfiniteData<ApiKeyUsageResponse, unknown>, QueryKey<Options<KeyUsageData>>, number | Pick<Pick<Options<KeyUsageData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
253
278
  _id: string;
254
279
  _infinite?: boolean;
255
280
  tags?: ReadonlyArray<string>;
@@ -266,7 +291,7 @@ declare const keyUsageInfiniteOptions: (options: Options<KeyUsageData>) => _tans
266
291
  } & {
267
292
  queryKey: QueryKey<Options<KeyUsageData>> & {
268
293
  [dataTagSymbol]: InfiniteData<ApiKeyUsageResponse, unknown>;
269
- [dataTagErrorSymbol]: BadRequestResponse;
294
+ [dataTagErrorSymbol]: ErrorResponse;
270
295
  };
271
296
  };
272
297
  declare const keyLogsQueryKey: (options: Options<KeyLogsData>) => [Pick<Options<KeyLogsData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
@@ -277,30 +302,40 @@ declare const keyLogsQueryKey: (options: Options<KeyLogsData>) => [Pick<Options<
277
302
  /**
278
303
  * Logs (CSV)
279
304
  *
280
- * Reports lookup information on a key for paid lookups.
305
+ * Returns a CSV of the paid lookups made on a key, with the information recorded against each one.
306
+ *
307
+ * This method requires a `user_token`, which can be found on your [accounts page](https://account.ideal-postcodes.co.uk/account).
281
308
  *
282
- * This method requires a `user_token`, which can be found on your [accounts page](https://ideal-postcodes.co.uk/account).
309
+ * You can request a maximum interval of 90 days. Without a start or end date, the interval defaults to the last 21 days.
283
310
  *
284
- * A maximum interval of 90 days can be provided for analysis. If no start or end date is provided, the last 21 days will be used as the default interval.
311
+ * The `Content-Type` returned is CSV (text/csv). For a non-200 response it reverts to JSON, with the error code and message in the body.
285
312
  *
286
- * ## Download Usage History (CSV)
313
+ * ## CSV Format
287
314
  *
288
- * `GET /keys/:key/lookups`
315
+ * The CSV has no header row. Columns, in order:
289
316
  *
290
- * Returns a CSV download of lookups performed and associated information.
317
+ * 1. Timestamp (ISO 8601)
318
+ * 2. IP address the request was received from
319
+ * 3. Search term
320
+ * 4. URL the request originated from
321
+ * 5. Lookup type
322
+ * 6. Tags
323
+ * 7. Lookups consumed
324
+ * 8. Licensee name (sublicensing keys only)
325
+ * 9. Source IP address
291
326
  *
292
- * Note that the Content-Type returned will be CSV (text/csv). For a non 200 response, the `Content-Type` will revert to JSON with the error code and message embedded.
327
+ * The source IP column carries the address forwarded in the `IDPC-Source-IP` header. It is only recorded for keys with IP address forwarding enabled, and only when the header holds a valid IP address. It is empty otherwise.
293
328
  *
294
329
  * ## Data Redaction
295
330
  *
296
- * Personally Identifiable Data (PII) caught in this your usage log (including IP, search term and URL data) will be redacted on a weekly basis.
331
+ * We redact Personally Identifiable Data (PII) in your usage log (including IP, source IP, search term and URL data) weekly.
297
332
  *
298
- * By default, PII will be redacted if it is older than 21 days. This timeframe can be configured from your dashboard.
333
+ * By default we redact PII older than 28 days. You can change this period from your dashboard.
299
334
  *
300
- * You may prevent PII collection altogether by setting the interval to `0` days.
335
+ * Set the interval to `0` days to prevent PII collection altogether.
301
336
  *
302
337
  */
303
- declare const keyLogsOptions: (options: Options<KeyLogsData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<string, BadRequestResponse, string, [Pick<Options<KeyLogsData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
338
+ declare const keyLogsOptions: (options: Options<KeyLogsData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<string, ErrorResponse, string, [Pick<Options<KeyLogsData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
304
339
  _id: string;
305
340
  _infinite?: boolean;
306
341
  tags?: ReadonlyArray<string>;
@@ -317,37 +352,47 @@ declare const keyLogsOptions: (options: Options<KeyLogsData>) => _tanstack_react
317
352
  tags?: ReadonlyArray<string>;
318
353
  }] & {
319
354
  [dataTagSymbol]: string;
320
- [dataTagErrorSymbol]: BadRequestResponse;
355
+ [dataTagErrorSymbol]: ErrorResponse;
321
356
  };
322
357
  };
323
358
  declare const keyLogsInfiniteQueryKey: (options: Options<KeyLogsData>) => QueryKey<Options<KeyLogsData>>;
324
359
  /**
325
360
  * Logs (CSV)
326
361
  *
327
- * Reports lookup information on a key for paid lookups.
362
+ * Returns a CSV of the paid lookups made on a key, with the information recorded against each one.
363
+ *
364
+ * This method requires a `user_token`, which can be found on your [accounts page](https://account.ideal-postcodes.co.uk/account).
328
365
  *
329
- * This method requires a `user_token`, which can be found on your [accounts page](https://ideal-postcodes.co.uk/account).
366
+ * You can request a maximum interval of 90 days. Without a start or end date, the interval defaults to the last 21 days.
330
367
  *
331
- * A maximum interval of 90 days can be provided for analysis. If no start or end date is provided, the last 21 days will be used as the default interval.
368
+ * The `Content-Type` returned is CSV (text/csv). For a non-200 response it reverts to JSON, with the error code and message in the body.
332
369
  *
333
- * ## Download Usage History (CSV)
370
+ * ## CSV Format
334
371
  *
335
- * `GET /keys/:key/lookups`
372
+ * The CSV has no header row. Columns, in order:
336
373
  *
337
- * Returns a CSV download of lookups performed and associated information.
374
+ * 1. Timestamp (ISO 8601)
375
+ * 2. IP address the request was received from
376
+ * 3. Search term
377
+ * 4. URL the request originated from
378
+ * 5. Lookup type
379
+ * 6. Tags
380
+ * 7. Lookups consumed
381
+ * 8. Licensee name (sublicensing keys only)
382
+ * 9. Source IP address
338
383
  *
339
- * Note that the Content-Type returned will be CSV (text/csv). For a non 200 response, the `Content-Type` will revert to JSON with the error code and message embedded.
384
+ * The source IP column carries the address forwarded in the `IDPC-Source-IP` header. It is only recorded for keys with IP address forwarding enabled, and only when the header holds a valid IP address. It is empty otherwise.
340
385
  *
341
386
  * ## Data Redaction
342
387
  *
343
- * Personally Identifiable Data (PII) caught in this your usage log (including IP, search term and URL data) will be redacted on a weekly basis.
388
+ * We redact Personally Identifiable Data (PII) in your usage log (including IP, source IP, search term and URL data) weekly.
344
389
  *
345
- * By default, PII will be redacted if it is older than 21 days. This timeframe can be configured from your dashboard.
390
+ * By default we redact PII older than 28 days. You can change this period from your dashboard.
346
391
  *
347
- * You may prevent PII collection altogether by setting the interval to `0` days.
392
+ * Set the interval to `0` days to prevent PII collection altogether.
348
393
  *
349
394
  */
350
- declare const keyLogsInfiniteOptions: (options: Options<KeyLogsData>) => _tanstack_react_query.UseInfiniteQueryOptions<string, BadRequestResponse, InfiniteData<string, unknown>, QueryKey<Options<KeyLogsData>>, number | Pick<Pick<Options<KeyLogsData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
395
+ declare const keyLogsInfiniteOptions: (options: Options<KeyLogsData>) => _tanstack_react_query.UseInfiniteQueryOptions<string, ErrorResponse, InfiniteData<string, unknown>, QueryKey<Options<KeyLogsData>>, number | Pick<Pick<Options<KeyLogsData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
351
396
  _id: string;
352
397
  _infinite?: boolean;
353
398
  tags?: ReadonlyArray<string>;
@@ -364,27 +409,30 @@ declare const keyLogsInfiniteOptions: (options: Options<KeyLogsData>) => _tansta
364
409
  } & {
365
410
  queryKey: QueryKey<Options<KeyLogsData>> & {
366
411
  [dataTagSymbol]: InfiniteData<string, unknown>;
367
- [dataTagErrorSymbol]: BadRequestResponse;
412
+ [dataTagErrorSymbol]: ErrorResponse;
368
413
  };
369
414
  };
370
415
  /**
371
416
  * Cleanse Address
372
417
  *
373
- * The address cleanse API attempts to return the closest matching address for any given address inputs. We also return a number of Match Level indicators that describe the degree to which the suggested address matches the input address. The more impaired the input address, the harder it is to cleanse.
418
+ * Returns the closest matching address for a freeform address input, with Match Level indicators describing how closely each element of the suggested address matches the input. The more impaired the input address, the harder it is to cleanse.
419
+ *
420
+ * A cleanse that returns a match costs a lookup. A no-match response is free.
374
421
  *
375
422
  * ## Confidence Score
376
423
  *
377
- * The confidence score is a number ranging between 0 and 1. Where 1 implies a full match and 0 implies no major elements completely match. Each incorrect, missing or misspelled element will subtract from the overall confidence score.
424
+ * Each incorrect, missing or misspelled element subtracts from the overall confidence score.
378
425
  *
379
426
  * ### Deciding on an Acceptable Confidence Score Threshold
380
427
  *
381
- * Different address cleanse projects can have radically different inputs. However, within each project, the inputs tend to repeat the same errors. For instance, some input datasets may be exclusively inputted manually and be prone to typos. Others may have a persistently missing datapoint such as organisation name or postcode. For this reason, it is important to understand that there is no absolute Confidence Score threshold. Instead, the acceptable confidence score must be determined on a project by project basis based on systematic errors present in the data and business goals.
428
+ * Inputs differ widely between address cleanse projects. Within a project, though, they tend to repeat the same errors. Some datasets are keyed in by hand and prone to typos. Others have a persistently missing datapoint such as organisation name or postcode. There is no absolute Confidence Score threshold. Set the acceptable score project by project, based on the systematic errors in the data and your business goals.
429
+ *
430
+ * To set a threshold, load a subset of the dataset into a spreadsheet application like Excel and sort on the score. Scrolling from top to bottom shows matches from best to worst. As you reach the lower quality searches you can judge roughly:
382
431
  *
383
- * When determining an acceptable Confidence Score threshold you should load a subset of the dataset into a spreadsheet application like Excel and sort on the score. Scrolling from top-to-bottom you will be able to observe matches from best to worst. As you start to hit the lower quality searches, you will be able to roughly determine:
384
432
  * - Which confidence scores indicate ambiguous matches (i.e. up to building level only)
385
433
  * - Which confidence scores indicate a poor or no match (i.e. the nearest matching address is too far from the input address)
386
434
  *
387
- * Depending on your business goals, you can also use the Match Levels to determine an acceptable match. For instance, do you need to match up to the thoroughfare or building name only? Are accurate organisation names an important feature?
435
+ * Depending on your business goals, you can also use the Match Levels to determine an acceptable match. You may need to match only up to the thoroughfare or building name, or accurate organisation names may matter.
388
436
  *
389
437
  */
390
438
  declare const addressCleanseMutation: (options?: Partial<Options<AddressCleanseData>>) => UseMutationOptions<AddressCleanseResponse, AddressCleanseError, Options<AddressCleanseData>>;
@@ -396,9 +444,9 @@ declare const findAddressQueryKey: (options?: Options<FindAddressData>) => [Pick
396
444
  /**
397
445
  * Find Address
398
446
  *
399
- * The Address Autocomplete API delivers address suggestions in order of relevance based on a provided query. It aids real-time address autofill implementations.
447
+ * Returns address suggestions for a partial address, ordered by relevance. Use it to power real-time address autofill.
400
448
  *
401
- * Consider using our Address Autocomplete JavaScript libraries to add address lookup to a form in moments rather than interacting with this API directly.
449
+ * Consider our address autocomplete JavaScript libraries, which add address lookup to a form without calling this API directly.
402
450
  *
403
451
  * ## API Usage
404
452
  *
@@ -407,38 +455,44 @@ declare const findAddressQueryKey: (options?: Options<FindAddressData>) => [Pick
407
455
  * 1. Fetch address suggestions with `/autocomplete/addresses`
408
456
  * 2. Acquire the complete address using the ID from the suggestion
409
457
  *
410
- * Step 2 will decrement your lookup balance.
458
+ * Step 2 decrements your lookup balance.
459
+ *
460
+ * Step 1 is not a free standalone resource. We rate limit and then suspend integrations that repeatedly make autocomplete requests without a paid Step 2 request.
461
+ *
462
+ * ## Context
411
463
  *
412
- * Note that step 1 is not a free standalone resource. Integrations that consistently make autocomplete requests without a paid Step 2 request will be rate limited and then suspended.
464
+ * `context` limits the search, usually to a single country. It defaults to `GBR`, and an unrecognised context falls back to that default. If your key is not licensed for the datasets covering the context, the request is rejected.
465
+ *
466
+ * Querying a full postcode within a supported context returns the entire address list for that postcode.
413
467
  *
414
468
  * ## Query Filters
415
469
  *
416
- * Refine results by appending filters to your querystring, e.g., `postcode=sw1a2aa` for postcode `SW1A 2AA`. Invalid filters return an empty set without affecting your lookup count.
470
+ * Refine results by appending filters to your querystring, e.g. `postcode=sw1a2aa` for postcode `SW1A 2AA`. Invalid filters return an empty set without affecting your lookup count.
417
471
  *
418
- * To apply multiple filter terms, use a comma-separated list, e.g., `postcode_outward=e1,e2,e3` combines result sets for E1, E2, and E3. Unless otherwise specified, all filters support multiple terms.
472
+ * To apply multiple filter terms, use a comma-separated list, e.g. `postcode_outward=e1,e2,e3` combines result sets for E1, E2 and E3. Unless otherwise specified, all filters support multiple terms.
419
473
  *
420
- * Combine filters by `AND` logic, for instance, `su_organisation_indicator=Y&postcode_area=n`. The maximum allowed filter terms is **10**.
474
+ * Filters combine with `AND` logic, for instance `su_organisation_indicator=Y&postcode_area=n`. The maximum is **8** filter terms.
421
475
  *
422
476
  * ## Address Bias
423
477
  *
424
478
  * Preface bias searches with `bias_` to boost certain address results. Unlike filters, biasing allows unmatched addresses to appear with lower priority.
425
479
  *
426
- * For example, use `bias_postcode_area=SW,SE` to favor addresses in the `SW` and `SE` postcode areas. Invalid bias terms have no effect.
480
+ * For example, use `bias_postcode_area=SW,SE` to favour addresses in the `SW` and `SE` postcode areas. Invalid bias terms have no effect.
427
481
  *
428
482
  * Multiple bias terms are allowed unless stated otherwise, with a combined maximum of **5**.
429
483
  *
430
484
  * ## Suggestion Format
431
485
  *
432
- * The suggestion format is subject to change. We recommend using the suggestion as-is to prevent potential integration issues.
486
+ * The suggestion format is subject to change. We recommend using the suggestion as-is to avoid integration issues.
433
487
  *
434
488
  * ## Rate Limiting and Cost
435
489
  *
436
- * The rate limit for the Autocomplete API is 3000 requests per 5 minutes. HTTP Headers inform about the current rate limit.
490
+ * The default rate limit is 3,000 requests per 5 minutes, counted per key and IP address. The `X-RateLimit-Limit`, `X-RateLimit-Remaining` and `X-RateLimit-Reset` headers report where you stand.
437
491
  *
438
- * Autocomplete API usage does not impact your balance, but resolving a suggestion to a full address requires a paid request. Autocomplete requests without subsequent paid requests may result in rate limitation or suspension.
492
+ * Autocomplete API usage does not impact your balance, but resolving a suggestion to a full address requires a paid request. Autocomplete requests without subsequent paid requests may lead to rate limiting or suspension.
439
493
  *
440
494
  */
441
- declare const findAddressOptions: (options?: Options<FindAddressData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<AutocompleteResponse, BadRequestResponse, AutocompleteResponse, [Pick<Options<FindAddressData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
495
+ declare const findAddressOptions: (options?: Options<FindAddressData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<AutocompleteResponse, ErrorResponse, AutocompleteResponse, [Pick<Options<FindAddressData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
442
496
  _id: string;
443
497
  _infinite?: boolean;
444
498
  tags?: ReadonlyArray<string>;
@@ -455,7 +509,7 @@ declare const findAddressOptions: (options?: Options<FindAddressData>) => _tanst
455
509
  tags?: ReadonlyArray<string>;
456
510
  }] & {
457
511
  [dataTagSymbol]: AutocompleteResponse;
458
- [dataTagErrorSymbol]: BadRequestResponse;
512
+ [dataTagErrorSymbol]: ErrorResponse;
459
513
  };
460
514
  };
461
515
  declare const resolveAddressQueryKey: (options: Options<ResolveAddressData>) => [Pick<Options<ResolveAddressData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
@@ -466,9 +520,13 @@ declare const resolveAddressQueryKey: (options: Options<ResolveAddressData>) =>
466
520
  /**
467
521
  * Resolve Address
468
522
  *
469
- * Resolves an address autocompletion by its address ID.
523
+ * Returns the complete address for an autocomplete suggestion, identified by its address ID.
524
+ *
525
+ * This is the step of the autocomplete flow that costs a lookup. Fetching suggestions is free.
470
526
  *
471
- * Resolved addresses (including global addresses) are returned in a UK format (up to 3 address lines) using UK nomenclature (like postcode and county).
527
+ * The API returns resolved addresses, including addresses outside the UK, in a UK format (up to 3 address lines) using UK nomenclature such as postcode and county.
528
+ *
529
+ * An ID that matches no address returns `404`.
472
530
  *
473
531
  */
474
532
  declare const resolveAddressOptions: (options: Options<ResolveAddressData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<GbrResolveAddressResponse, ErrorResponse, GbrResolveAddressResponse, [Pick<Options<ResolveAddressData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
@@ -491,6 +549,190 @@ declare const resolveAddressOptions: (options: Options<ResolveAddressData>) => _
491
549
  [dataTagErrorSymbol]: ErrorResponse;
492
550
  };
493
551
  };
552
+ declare const addressesQueryKey: (options?: Options<AddressesData>) => [Pick<Options<AddressesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
553
+ _id: string;
554
+ _infinite?: boolean;
555
+ tags?: ReadonlyArray<string>;
556
+ }];
557
+ /**
558
+ * Extract Addresses
559
+ *
560
+ * Returns a list of UK addresses matching the query, ordered by relevance score. `limit` defaults to 10 and caps at 100. `page` defaults to 0.
561
+ *
562
+ * You may only extract a single address from each request. To extract multiple addresses, you must perform an individual request for each address.
563
+ *
564
+ * If the query is a valid postcode, the API returns the whole address list for that postcode and raises the limit to 100. Use `page` to reach the rest of a postcode holding more than 100 premises. You cannot page beyond 10,000 results.
565
+ *
566
+ * Your key needs at least one of PAF, Multiple Residence, Not Yet Built, PAF Alias, PAF Welsh, AddressBase or AddressBase Premium. Without one the request is rejected.
567
+ *
568
+ * A request that returns at least one address costs a lookup. Empty result sets are free.
569
+ *
570
+ * ## Reverse Geocoding
571
+ *
572
+ * Return the addresses around a point with the `lon=` and `lat=` querystring arguments. The search radius is 100m and the API sorts addresses by distance from the point.
573
+ *
574
+ * ## Filters
575
+ *
576
+ * Narrow your results by adding filters to your query string that correspond with an address attribute.
577
+ *
578
+ * For instance, you can restrict to postcode `SW1A 2AA` by appending `postcode=sw1a2aa`.
579
+ *
580
+ * If a filter term is invalid, e.g. `postcode=SW1A2AAA`, the API returns an empty result set and charges no lookup.
581
+ *
582
+ * You can also scope using multiple terms for the same filter with a comma separated list of terms. E.g. Restrict results to E1, E2 and E3 outward codes: `postcode_outward=e1,e2,e3`. Multiple terms are `OR`'ed, i.e. the matching result sets are combined.
583
+ *
584
+ * All filters can accept multiple terms unless stated otherwise below.
585
+ *
586
+ * Multiple filters can also be combined. E.g. Restrict results to small user organisations in the N postcode area: `su_organisation_indicator=Y&postcode_area=n`. Multiple filters are `AND`'ed, i.e. each additional filter narrows the result set.
587
+ *
588
+ * A combined maximum of 8 terms is allowed across all filters.
589
+ *
590
+ * ## Biases
591
+ *
592
+ * You can boost address results that correspond with a given address attribute. All bias searches are prefixed with `bias_`.
593
+ *
594
+ * Biased searches, unlike filtered searches, still allow unmatched addresses to appear. They rank lower.
595
+ *
596
+ * For instance, you can boost addresses with postcode areas `SW` and `SE` by appending `bias_postcode_area=SW,SE`.
597
+ *
598
+ * If a bias term is invalid, e.g. `bias_postcode=SW1A2AAA`, no bias is applied.
599
+ *
600
+ * You may scope using multiple terms for the same bias with a comma separated list of terms. E.g. Prefer results in the `E1`, `E2` and `E3` outward codes: `bias_postcode_outward=e1,e2,e3`.
601
+ *
602
+ * All biases can accept multiple terms unless stated otherwise below.
603
+ *
604
+ * A combined maximum of 5 terms is allowed across all biases.
605
+ *
606
+ * ## Search by Postcode and Building Name or Number
607
+ *
608
+ * Search by postcode and building attribute with the postcode filter and query argument. E.g. For "SW1A 2AA Prime Minister" `/v1/addresses?postcode=sw1a2aa&q=prime minister`.
609
+ *
610
+ * Using a filter means a postcode mismatch returns no results and costs no lookup.
611
+ *
612
+ * ### Search by UPRN
613
+ *
614
+ * Search by UPRN using the `uprn` filter and excluding the query argument. E.g. `/v1/addresses?uprn=100`.
615
+ *
616
+ * ## Testing
617
+ *
618
+ * - **ID1 1QD** Returns a successful query response `2000`
619
+ * - **ID1 KFA** Returns an empty query response `2000`
620
+ * - **ID1 CLIP** Returns "no lookups remaining" error `4020`
621
+ * - **ID1 CHOP** Returns "daily (or individual) lookup limit breached" error `4021`
622
+ *
623
+ * Test requests undergo the usual authentication and restriction rules. They surface any issues during implementation and do not cost you a lookup.
624
+ *
625
+ */
626
+ declare const addressesOptions: (options?: Options<AddressesData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<AddressResponse, AddressesError, AddressResponse, [Pick<Options<AddressesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
627
+ _id: string;
628
+ _infinite?: boolean;
629
+ tags?: ReadonlyArray<string>;
630
+ }]>, "queryFn"> & {
631
+ queryFn?: _tanstack_react_query.QueryFunction<AddressResponse, [Pick<Options<AddressesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
632
+ _id: string;
633
+ _infinite?: boolean;
634
+ tags?: ReadonlyArray<string>;
635
+ }], never> | undefined;
636
+ } & {
637
+ queryKey: [Pick<Options<AddressesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
638
+ _id: string;
639
+ _infinite?: boolean;
640
+ tags?: ReadonlyArray<string>;
641
+ }] & {
642
+ [dataTagSymbol]: AddressResponse;
643
+ [dataTagErrorSymbol]: AddressesError;
644
+ };
645
+ };
646
+ declare const addressesInfiniteQueryKey: (options?: Options<AddressesData>) => QueryKey<Options<AddressesData>>;
647
+ /**
648
+ * Extract Addresses
649
+ *
650
+ * Returns a list of UK addresses matching the query, ordered by relevance score. `limit` defaults to 10 and caps at 100. `page` defaults to 0.
651
+ *
652
+ * You may only extract a single address from each request. To extract multiple addresses, you must perform an individual request for each address.
653
+ *
654
+ * If the query is a valid postcode, the API returns the whole address list for that postcode and raises the limit to 100. Use `page` to reach the rest of a postcode holding more than 100 premises. You cannot page beyond 10,000 results.
655
+ *
656
+ * Your key needs at least one of PAF, Multiple Residence, Not Yet Built, PAF Alias, PAF Welsh, AddressBase or AddressBase Premium. Without one the request is rejected.
657
+ *
658
+ * A request that returns at least one address costs a lookup. Empty result sets are free.
659
+ *
660
+ * ## Reverse Geocoding
661
+ *
662
+ * Return the addresses around a point with the `lon=` and `lat=` querystring arguments. The search radius is 100m and the API sorts addresses by distance from the point.
663
+ *
664
+ * ## Filters
665
+ *
666
+ * Narrow your results by adding filters to your query string that correspond with an address attribute.
667
+ *
668
+ * For instance, you can restrict to postcode `SW1A 2AA` by appending `postcode=sw1a2aa`.
669
+ *
670
+ * If a filter term is invalid, e.g. `postcode=SW1A2AAA`, the API returns an empty result set and charges no lookup.
671
+ *
672
+ * You can also scope using multiple terms for the same filter with a comma separated list of terms. E.g. Restrict results to E1, E2 and E3 outward codes: `postcode_outward=e1,e2,e3`. Multiple terms are `OR`'ed, i.e. the matching result sets are combined.
673
+ *
674
+ * All filters can accept multiple terms unless stated otherwise below.
675
+ *
676
+ * Multiple filters can also be combined. E.g. Restrict results to small user organisations in the N postcode area: `su_organisation_indicator=Y&postcode_area=n`. Multiple filters are `AND`'ed, i.e. each additional filter narrows the result set.
677
+ *
678
+ * A combined maximum of 8 terms is allowed across all filters.
679
+ *
680
+ * ## Biases
681
+ *
682
+ * You can boost address results that correspond with a given address attribute. All bias searches are prefixed with `bias_`.
683
+ *
684
+ * Biased searches, unlike filtered searches, still allow unmatched addresses to appear. They rank lower.
685
+ *
686
+ * For instance, you can boost addresses with postcode areas `SW` and `SE` by appending `bias_postcode_area=SW,SE`.
687
+ *
688
+ * If a bias term is invalid, e.g. `bias_postcode=SW1A2AAA`, no bias is applied.
689
+ *
690
+ * You may scope using multiple terms for the same bias with a comma separated list of terms. E.g. Prefer results in the `E1`, `E2` and `E3` outward codes: `bias_postcode_outward=e1,e2,e3`.
691
+ *
692
+ * All biases can accept multiple terms unless stated otherwise below.
693
+ *
694
+ * A combined maximum of 5 terms is allowed across all biases.
695
+ *
696
+ * ## Search by Postcode and Building Name or Number
697
+ *
698
+ * Search by postcode and building attribute with the postcode filter and query argument. E.g. For "SW1A 2AA Prime Minister" `/v1/addresses?postcode=sw1a2aa&q=prime minister`.
699
+ *
700
+ * Using a filter means a postcode mismatch returns no results and costs no lookup.
701
+ *
702
+ * ### Search by UPRN
703
+ *
704
+ * Search by UPRN using the `uprn` filter and excluding the query argument. E.g. `/v1/addresses?uprn=100`.
705
+ *
706
+ * ## Testing
707
+ *
708
+ * - **ID1 1QD** Returns a successful query response `2000`
709
+ * - **ID1 KFA** Returns an empty query response `2000`
710
+ * - **ID1 CLIP** Returns "no lookups remaining" error `4020`
711
+ * - **ID1 CHOP** Returns "daily (or individual) lookup limit breached" error `4021`
712
+ *
713
+ * Test requests undergo the usual authentication and restriction rules. They surface any issues during implementation and do not cost you a lookup.
714
+ *
715
+ */
716
+ declare const addressesInfiniteOptions: (options?: Options<AddressesData>) => _tanstack_react_query.UseInfiniteQueryOptions<AddressResponse, AddressesError, InfiniteData<AddressResponse, unknown>, QueryKey<Options<AddressesData>>, number | Pick<Pick<Options<AddressesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
717
+ _id: string;
718
+ _infinite?: boolean;
719
+ tags?: ReadonlyArray<string>;
720
+ }, "query" | "body" | "headers" | "path">> & {
721
+ initialData: InfiniteData<AddressResponse, number | Pick<Pick<Options<AddressesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
722
+ _id: string;
723
+ _infinite?: boolean;
724
+ tags?: ReadonlyArray<string>;
725
+ }, "query" | "body" | "headers" | "path">> | (() => InfiniteData<AddressResponse, number | Pick<Pick<Options<AddressesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
726
+ _id: string;
727
+ _infinite?: boolean;
728
+ tags?: ReadonlyArray<string>;
729
+ }, "query" | "body" | "headers" | "path">>) | undefined;
730
+ } & {
731
+ queryKey: QueryKey<Options<AddressesData>> & {
732
+ [dataTagSymbol]: InfiniteData<AddressResponse, unknown>;
733
+ [dataTagErrorSymbol]: AddressesError;
734
+ };
735
+ };
494
736
  declare const findPlaceQueryKey: (options?: Options<FindPlaceData>) => [Pick<Options<FindPlaceData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
495
737
  _id: string;
496
738
  _infinite?: boolean;
@@ -499,29 +741,25 @@ declare const findPlaceQueryKey: (options?: Options<FindPlaceData>) => [Pick<Opt
499
741
  /**
500
742
  * Find Place
501
743
  *
502
- * Query for geographical places across countries. Each query will return a list of place suggestions, which consists of a place name, descriptive name and id.
503
- *
504
- * This API returns geographical information such as countries, capitals, administrative areas and more. It is ideal for correctly identifying a place along with any other details like geolocation.
744
+ * Returns place suggestions for a query, ranked by relevance. Places cover countries, administrative areas, capitals and other administrative seats.
505
745
  *
506
746
  * ## Implementing Place Autocomplete
507
747
  *
508
- * Extracting the full information of a place is a 2 step process:
748
+ * Retrieving a full place takes two requests:
509
749
  *
510
- * 1. Retrieve place suggestions via /places
511
- * 2. Retrieve the entire place with the ID provided in the suggestion
750
+ * 1. Fetch suggestions from `/places`
751
+ * 2. Fetch the place using the `id` on a suggestion
512
752
  *
513
- * ## Suggestion Format
514
- *
515
- * Each place suggestion contains a descriptive name which you can provide to users to uniquely identify a place.
753
+ * A query returns at most 10 suggestions. An empty query returns an empty result set. Show users the `descriptive_name`. The API drops suggestions that share one, so each name in a response identifies a single place.
516
754
  *
517
755
  * ## Rate Limiting and Cost
518
756
  *
519
- * The rate limit for the Autocomplete API is 3000 requests per 5 minutes. HTTP Headers inform about the current rate limit.
757
+ * The rate limit is 3,000 requests per 5 minutes.
520
758
  *
521
- * Autocomplete API usage does not impact your balance, but resolving a suggestion to a full address requires a paid request. Autocomplete requests without subsequent paid requests may result in rate limitation or suspension.
759
+ * `/places` does not decrement your lookup balance, but resolving a suggestion to a full place does. We rate limit and then suspend integrations that repeatedly call `/places` without resolving.
522
760
  *
523
761
  */
524
- declare const findPlaceOptions: (options?: Options<FindPlaceData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<PlaceResponse, BadRequestResponse, PlaceResponse, [Pick<Options<FindPlaceData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
762
+ declare const findPlaceOptions: (options?: Options<FindPlaceData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<PlaceResponse, ErrorResponse, PlaceResponse, [Pick<Options<FindPlaceData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
525
763
  _id: string;
526
764
  _infinite?: boolean;
527
765
  tags?: ReadonlyArray<string>;
@@ -538,7 +776,7 @@ declare const findPlaceOptions: (options?: Options<FindPlaceData>) => _tanstack_
538
776
  tags?: ReadonlyArray<string>;
539
777
  }] & {
540
778
  [dataTagSymbol]: PlaceResponse;
541
- [dataTagErrorSymbol]: BadRequestResponse;
779
+ [dataTagErrorSymbol]: ErrorResponse;
542
780
  };
543
781
  };
544
782
  declare const resolvePlaceQueryKey: (options: Options<ResolvePlaceData>) => [Pick<Options<ResolvePlaceData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
@@ -549,7 +787,11 @@ declare const resolvePlaceQueryKey: (options: Options<ResolvePlaceData>) => [Pic
549
787
  /**
550
788
  * Resolve Place
551
789
  *
552
- * Resolves a place autocompletion by its place ID.
790
+ * Returns the full place for a place ID taken from a `/places` suggestion.
791
+ *
792
+ * On top of the fields carried by the suggestion, the response adds coordinates, language and the underlying dataset record.
793
+ *
794
+ * Each request decrements your lookup balance. An unknown ID returns `404`.
553
795
  *
554
796
  */
555
797
  declare const resolvePlaceOptions: (options: Options<ResolvePlaceData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ResolvePlaceResponse, ErrorResponse, ResolvePlaceResponse, [Pick<Options<ResolvePlaceData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
@@ -580,9 +822,9 @@ declare const listLicenseesQueryKey: (options: Options<ListLicenseesData>) => [P
580
822
  /**
581
823
  * List
582
824
  *
583
- * Returns a list of licensees for a key.
825
+ * Returns a key's licensees, oldest first, up to 100 per request. The list omits cancelled licensees. The key must be enabled for sub-licensing.
584
826
  */
585
- declare const listLicenseesOptions: (options: Options<ListLicenseesData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<LicenseesResponse, BadRequestResponse, LicenseesResponse, [Pick<Options<ListLicenseesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
827
+ declare const listLicenseesOptions: (options: Options<ListLicenseesData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<LicenseesResponse, ErrorResponse, LicenseesResponse, [Pick<Options<ListLicenseesData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
586
828
  _id: string;
587
829
  _infinite?: boolean;
588
830
  tags?: ReadonlyArray<string>;
@@ -599,19 +841,19 @@ declare const listLicenseesOptions: (options: Options<ListLicenseesData>) => _ta
599
841
  tags?: ReadonlyArray<string>;
600
842
  }] & {
601
843
  [dataTagSymbol]: LicenseesResponse;
602
- [dataTagErrorSymbol]: BadRequestResponse;
844
+ [dataTagErrorSymbol]: ErrorResponse;
603
845
  };
604
846
  };
605
847
  /**
606
848
  * Create
607
849
  *
608
- * Create a licensee for the specified API Key.
850
+ * Creates a licensee on a key and returns it with its generated `sl_` key. The key must be enabled for sub-licensing.
609
851
  */
610
852
  declare const createLicenseeMutation: (options?: Partial<Options<CreateLicenseeData>>) => UseMutationOptions<CreateLicenseeResponse, CreateLicenseeError, Options<CreateLicenseeData>>;
611
853
  /**
612
854
  * Cancel
613
855
  *
614
- * Cancels a licensee key. This renders a licensee unusable. This action can be reversed if you get in contact with us.
856
+ * Cancels a licensee. Its key stops working and it drops out of the licensee list. Contact us to reverse it.
615
857
  */
616
858
  declare const deleteLicenseeMutation: (options?: Partial<Options<DeleteLicenseeData>>) => UseMutationOptions<DeleteLicenseeResponse, DeleteLicenseeError, Options<DeleteLicenseeData>>;
617
859
  declare const retrieveLicenseeQueryKey: (options: Options<RetrieveLicenseeData>) => [Pick<Options<RetrieveLicenseeData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
@@ -622,9 +864,9 @@ declare const retrieveLicenseeQueryKey: (options: Options<RetrieveLicenseeData>)
622
864
  /**
623
865
  * Retrieve
624
866
  *
625
- * Returns licensee information as identified by the licensee key.
867
+ * Returns a licensee by its `sl_` key. A cancelled or unknown licensee returns `404`.
626
868
  */
627
- declare const retrieveLicenseeOptions: (options: Options<RetrieveLicenseeData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<LicenseeResponse, BadRequestResponse, LicenseeResponse, [Pick<Options<RetrieveLicenseeData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
869
+ declare const retrieveLicenseeOptions: (options: Options<RetrieveLicenseeData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<LicenseeResponse, ErrorResponse, LicenseeResponse, [Pick<Options<RetrieveLicenseeData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
628
870
  _id: string;
629
871
  _infinite?: boolean;
630
872
  tags?: ReadonlyArray<string>;
@@ -641,15 +883,21 @@ declare const retrieveLicenseeOptions: (options: Options<RetrieveLicenseeData>)
641
883
  tags?: ReadonlyArray<string>;
642
884
  }] & {
643
885
  [dataTagSymbol]: LicenseeResponse;
644
- [dataTagErrorSymbol]: BadRequestResponse;
886
+ [dataTagErrorSymbol]: ErrorResponse;
645
887
  };
646
888
  };
647
889
  /**
648
890
  * Update
649
891
  *
650
- * Update Licensee
892
+ * Updates a licensee's address, postcode, allowed URLs and daily limit. Returns the updated licensee. The name is fixed at creation.
651
893
  */
652
894
  declare const updateLicenseeMutation: (options?: Partial<Options<UpdateLicenseeData>>) => UseMutationOptions<UpdateLicenseeResponse, UpdateLicenseeError, Options<UpdateLicenseeData>>;
895
+ /**
896
+ * Regenerate Key
897
+ *
898
+ * Regenerates a licensee's key and returns the licensee with the new key. The previous key stops working immediately, so update any integration that uses it.
899
+ */
900
+ declare const regenerateLicenseeKeyMutation: (options?: Partial<Options<RegenerateLicenseeKeyData>>) => UseMutationOptions<RegenerateLicenseeKeyResponse, RegenerateLicenseeKeyError, Options<RegenerateLicenseeKeyData>>;
653
901
  declare const listConfigsQueryKey: (options: Options<ListConfigsData>) => [Pick<Options<ListConfigsData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
654
902
  _id: string;
655
903
  _infinite?: boolean;
@@ -658,9 +906,9 @@ declare const listConfigsQueryKey: (options: Options<ListConfigsData>) => [Pick<
658
906
  /**
659
907
  * List
660
908
  *
661
- * Lists configurations associated with a key
909
+ * Returns every configuration stored against a key, oldest first.
662
910
  */
663
- declare const listConfigsOptions: (options: Options<ListConfigsData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ConfigsResponse, ListConfigsError, ConfigsResponse, [Pick<Options<ListConfigsData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
911
+ declare const listConfigsOptions: (options: Options<ListConfigsData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ConfigsResponse, ErrorResponse, ConfigsResponse, [Pick<Options<ListConfigsData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
664
912
  _id: string;
665
913
  _infinite?: boolean;
666
914
  tags?: ReadonlyArray<string>;
@@ -677,13 +925,13 @@ declare const listConfigsOptions: (options: Options<ListConfigsData>) => _tansta
677
925
  tags?: ReadonlyArray<string>;
678
926
  }] & {
679
927
  [dataTagSymbol]: ConfigsResponse;
680
- [dataTagErrorSymbol]: ListConfigsError;
928
+ [dataTagErrorSymbol]: ErrorResponse;
681
929
  };
682
930
  };
683
931
  /**
684
932
  * Create
685
933
  *
686
- * Create a configuration
934
+ * Creates a named configuration on a key and returns it.
687
935
  */
688
936
  declare const createConfigMutation: (options?: Partial<Options<CreateConfigData>>) => UseMutationOptions<CreateConfigResponse, CreateConfigError, Options<CreateConfigData>>;
689
937
  /**
@@ -700,7 +948,7 @@ declare const retrieveConfigQueryKey: (options: Options<RetrieveConfigData>) =>
700
948
  /**
701
949
  * Retrieve
702
950
  *
703
- * Retrieve configuration object by name
951
+ * Returns a configuration by name. This request needs no `user_token`, so a browser integration can read its own configuration at runtime.
704
952
  */
705
953
  declare const retrieveConfigOptions: (options: Options<RetrieveConfigData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<ConfigResponse, RetrieveConfigError, ConfigResponse, [Pick<Options<RetrieveConfigData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
706
954
  _id: string;
@@ -725,7 +973,7 @@ declare const retrieveConfigOptions: (options: Options<RetrieveConfigData>) => _
725
973
  /**
726
974
  * Update
727
975
  *
728
- * Updates configuration object
976
+ * Replaces a configuration's payload and returns the updated configuration. The name is fixed at creation.
729
977
  */
730
978
  declare const updateConfigMutation: (options?: Partial<Options<UpdateConfigData>>) => UseMutationOptions<UpdateConfigResponse, UpdateConfigError, Options<UpdateConfigData>>;
731
979
  declare const emailValidationQueryKey: (options: Options<EmailValidationData>) => [Pick<Options<EmailValidationData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
@@ -736,10 +984,14 @@ declare const emailValidationQueryKey: (options: Options<EmailValidationData>) =
736
984
  /**
737
985
  * Email Validation
738
986
  *
739
- * Query for and validate email addresses.
987
+ * Validates an email address and reports whether it is deliverable.
988
+ *
989
+ * Requires an API Key licensed for email validation. A query over 320 characters is rejected.
990
+ *
991
+ * A validated address decrements your lookup balance. An address the API cannot check returns `unknown` and costs no lookup. An address whose domain does not resolve, or publishes no MX records, returns `not_deliverable` and also costs no lookup. Only those two domain failures populate `suggestions`. Every other response returns an empty list.
740
992
  *
741
993
  */
742
- declare const emailValidationOptions: (options: Options<EmailValidationData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<EmailResponse, EmailValidationError, EmailResponse, [Pick<Options<EmailValidationData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
994
+ declare const emailValidationOptions: (options: Options<EmailValidationData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<EmailResponse, ErrorResponse, EmailResponse, [Pick<Options<EmailValidationData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
743
995
  _id: string;
744
996
  _infinite?: boolean;
745
997
  tags?: ReadonlyArray<string>;
@@ -756,7 +1008,7 @@ declare const emailValidationOptions: (options: Options<EmailValidationData>) =>
756
1008
  tags?: ReadonlyArray<string>;
757
1009
  }] & {
758
1010
  [dataTagSymbol]: EmailResponse;
759
- [dataTagErrorSymbol]: EmailValidationError;
1011
+ [dataTagErrorSymbol]: ErrorResponse;
760
1012
  };
761
1013
  };
762
1014
  declare const phoneNumberValidationQueryKey: (options: Options<PhoneNumberValidationData>) => [Pick<Options<PhoneNumberValidationData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
@@ -767,10 +1019,14 @@ declare const phoneNumberValidationQueryKey: (options: Options<PhoneNumberValida
767
1019
  /**
768
1020
  * Phone Number Validation
769
1021
  *
770
- * Query for and validate phone numbers.
1022
+ * Validates a phone number and returns its country, its national and international formats, and the network it was originally assigned to.
1023
+ *
1024
+ * Requires an API Key licensed for phone validation.
1025
+ *
1026
+ * Every query decrements your lookup balance, including a number that fails to parse and a number reported as invalid.
771
1027
  *
772
1028
  */
773
- declare const phoneNumberValidationOptions: (options: Options<PhoneNumberValidationData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<PhoneNumberResponse, PhoneNumberValidationError, PhoneNumberResponse, [Pick<Options<PhoneNumberValidationData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
1029
+ declare const phoneNumberValidationOptions: (options: Options<PhoneNumberValidationData>) => _tanstack_react_query.OmitKeyof<_tanstack_react_query.UseQueryOptions<PhoneNumberResponse, ErrorResponse, PhoneNumberResponse, [Pick<Options<PhoneNumberValidationData>, "query" | "body" | "headers" | "path" | "baseUrl"> & {
774
1030
  _id: string;
775
1031
  _infinite?: boolean;
776
1032
  tags?: ReadonlyArray<string>;
@@ -787,8 +1043,8 @@ declare const phoneNumberValidationOptions: (options: Options<PhoneNumberValidat
787
1043
  tags?: ReadonlyArray<string>;
788
1044
  }] & {
789
1045
  [dataTagSymbol]: PhoneNumberResponse;
790
- [dataTagErrorSymbol]: PhoneNumberValidationError;
1046
+ [dataTagErrorSymbol]: ErrorResponse;
791
1047
  };
792
1048
  };
793
1049
 
794
- export { type QueryKey, addressCleanseMutation, createConfigMutation, createLicenseeMutation, deleteConfigMutation, deleteLicenseeMutation, emailValidationOptions, emailValidationQueryKey, findAddressOptions, findAddressQueryKey, findPlaceOptions, findPlaceQueryKey, keyAvailabilityOptions, keyAvailabilityQueryKey, keyDetailsOptions, keyDetailsQueryKey, keyLogsInfiniteOptions, keyLogsInfiniteQueryKey, keyLogsOptions, keyLogsQueryKey, keyUsageInfiniteOptions, keyUsageInfiniteQueryKey, keyUsageOptions, keyUsageQueryKey, listConfigsOptions, listConfigsQueryKey, listLicenseesOptions, listLicenseesQueryKey, phoneNumberValidationOptions, phoneNumberValidationQueryKey, postcodesInfiniteOptions, postcodesInfiniteQueryKey, postcodesOptions, postcodesQueryKey, resolveAddressOptions, resolveAddressQueryKey, resolvePlaceOptions, resolvePlaceQueryKey, retrieveConfigOptions, retrieveConfigQueryKey, retrieveLicenseeOptions, retrieveLicenseeQueryKey, updateConfigMutation, updateKeyDetailsMutation, updateLicenseeMutation };
1050
+ export { type QueryKey, addressCleanseMutation, addressesInfiniteOptions, addressesInfiniteQueryKey, addressesOptions, addressesQueryKey, createConfigMutation, createLicenseeMutation, deleteConfigMutation, deleteLicenseeMutation, emailValidationOptions, emailValidationQueryKey, findAddressOptions, findAddressQueryKey, findPlaceOptions, findPlaceQueryKey, keyAvailabilityOptions, keyAvailabilityQueryKey, keyDetailsOptions, keyDetailsQueryKey, keyLogsInfiniteOptions, keyLogsInfiniteQueryKey, keyLogsOptions, keyLogsQueryKey, keyUsageInfiniteOptions, keyUsageInfiniteQueryKey, keyUsageOptions, keyUsageQueryKey, listConfigsOptions, listConfigsQueryKey, listLicenseesOptions, listLicenseesQueryKey, phoneNumberValidationOptions, phoneNumberValidationQueryKey, postcodesInfiniteOptions, postcodesInfiniteQueryKey, postcodesOptions, postcodesQueryKey, regenerateLicenseeKeyMutation, resolveAddressOptions, resolveAddressQueryKey, resolvePlaceOptions, resolvePlaceQueryKey, retrieveConfigOptions, retrieveConfigQueryKey, retrieveLicenseeOptions, retrieveLicenseeQueryKey, updateConfigMutation, updateKeyDetailsMutation, updateLicenseeMutation };