openapi: 3.0.3 info: title: Lob U S Autocompletions API version: 1.20.2 description: "Experience direct mail like never before, with unmatched personalization and scalability \x14 all in one intuitive platform." license: name: MIT url: https://mit-license.org/ contact: name: Lob Developer Experience url: https://support.lob.com/ email: lob-openapi@lob.com termsOfService: https://www.lob.com/legal servers: - url: https://api.lob.com/v1 description: production security: - basicAuth: [] tags: - name: U S Autocompletions paths: /us_autocompletions: post: operationId: autocompletion summary: Autocomplete description: Given an address prefix consisting of a partial primary line, as well as optional input of city, state, and zip code, this functionality returns up to 10 full US address suggestions. Not all of them will turn out to be valid addresses; they'll need to be [verified](#operation/verification_us). tags: - U S Autocompletions parameters: - in: query name: case schema: type: string enum: - upper - proper default: upper description: Casing of the verified address. Possible values are `upper` and `proper` for uppercased (e.g. "PO BOX") and proper-cased (e.g. "PO Box"), respectively. Only affects `primary_line`, `city`, and `state`. Default casing is `upper`. required: false - in: query name: valid_addresses schema: type: boolean enum: - true - false default: false description: Possible values are `true` and `false`. If false, not all of the suggestions in the response will be valid addresses; they'll need to be verified in order to determine the deliverability. The valid_addresses flag will greatly reduce the number of keystrokes needed before reaching an intended address. required: false requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/us_autocompletions_writable' examples: basic: value: address_prefix: 185 B city: San Francisco state: CA zip_code: '94107' geo_ip_sort: false test: value: address_prefix: 1 sugg application/x-www-form-urlencoded: schema: $ref: '#/components/schemas/us_autocompletions_writable' examples: basic: value: address_prefix: 185 B city: San Francisco state: CA zip_code: '94107' geo_ip_sort: false test: value: address_prefix: 1 sugg multipart/form-data: schema: $ref: '#/components/schemas/us_autocompletions_writable' examples: basic: value: address_prefix: 185 B city: San Francisco state: CA zip_code: '94107' geo_ip_sort: false test: value: address_prefix: 1 sugg responses: '200': $ref: '#/components/responses/us_autocompletions' default: $ref: '#/components/responses/us_autocompletions_error' x-codeSamples: - lang: Shell source: "curl https://api.lob.com/v1/us_autocompletions \\\n -u : \\\n -d \"address_prefix=185 B\" \\\n -d \"city=San Francisco\" \\\n -d \"state=CA\"\n -d \"zip_code=94107\"\n" label: CURL - lang: Typescript source: "const UsAutocompletions = new USAutocompletionsApi(av_config);\nconst autocompletionData: UsAutocompletionsWritable = {\n address_prefix: '185 B',\n city: 'SAN FRANCISCO'\n};\n\ntry {\n const autocompletedAddresses = await UsAutocompletions.autocomplete(autocompletionData);\n} catch (err: any) {\n console.error(err);\n}\n" label: TYPESCRIPT - lang: Javascript source: "Lob.usAutocompletions.autocomplete({\n address_prefix: '185 B',\n city: 'San Francisco',\n state: 'CA',\n zip_code: '94107',\n}, function (err, res) {\n console.log(err, res);\n});\n" label: NODE - lang: Ruby source: "usAutocompletionsApi = UsAutocompletionsApi.new(config)\n\nautocompletionData = UsAutocompletionsWritable.new({\n address_prefix: \"185 B\",\n city: \"San Francisco\",\n state: \"CA\",\n zip_code: \"94017\",\n})\n\nbegin\n autocompletedAddress = usAutocompletionsApi.autocomplete(autocompletionData)\nrescue => err\n p err.message\nend\n" label: RUBY - lang: Python source: "with ApiClient(configuration) as api_client:\n api = UsAutocompletionsApi(api_client)\n\nautocompletion_data = UsAutocompletionsWritable(\n address_prefix = \"185 B\",\n city = \"San Francisco\",\n state = \"CA\",\n zip_code = \"94017\",\n)\n\ntry:\n autocompleted_addresses = api.autocomplete(autocompletion_data)\nexcept ApiException as e:\n print(e)\n" label: PYTHON - lang: PHP source: "$apiInstance = new OpenAPI\\Client\\Api\\UsAutocompletionsApi($config, new GuzzleHttp\\Client());\n\n$autocompletionData = new OpenAPI\\Client\\Model\\UsAutocompletionsWritable(array(\n \"address_prefix\" => \"185 B\",\n \"city\" => \"San Francisco\",\n \"state\" => \"CA\",\n \"zip_code\" => \"94017\",\n));\n\ntry {\n $result = $apiInstance->autocomplete($autocompletionData);\n} catch (Exception $e) {\n echo $e->getMessage(), PHP_EOL;\n}\n" - lang: Java source: "UsAutocompletionsApi apiInstance = new UsAutocompletionsApi(config);\nUsAutocompletionsWritable autoCompletionWritable = new UsAutocompletionsWritable();\nautoCompletionWritable.setAddressPrefix(\"185 B\");\nautoCompletionWritable.setCity(\"San Francisco\");\nautoCompletionWritable.setState(\"CA\");\nautoCompletionWritable.setZipCode(\"94017\");\n\ntry {\n UsAutocompletions usAutocompletion = apiInstance.autocomplete(autoCompletionWritable);\n} catch (ApiException e) {\n e.printStackTrace();\n}\n" label: JAVA - lang: Elixir source: "Lob.USAutocompletion.autocomplete(%{\n address_prefix: \"185 B\",\n city: \"San Francisco\",\n state: \"CA\",\n zip_code: \"94107\"\n})\n" label: ELIXIR - lang: CSharp source: "UsAutocompletionsApi api = new UsAutocompletionsApi(config);\nUsAutocompletionsWritable autoCompletionWritable = new UsAutocompletionsWritable(\n \"185 B\", // address_prefix\n \"San Francisco\", // city\n \"CA\", // state\n \"94017\" // zip_code\n);\n\ntry {\n UsAutocompletions usAutocompletion = api.autocomplete(autoCompletionWritable);\n} catch (ApiException e) {\n Console.WriteLine(e.ToString());\n}\n" label: CSHARP - lang: Go source: "var context = context.Background()\ncontext = context.WithValue(context, lob.ContextBasicAuth, lob.BasicAuth{UserName: os.Getenv(\"\")})\n\nvar apiClient = *lob.NewAPIClient(configuration)\n\nvar usAutocomplationsWritable = *lob.NewUsAutocompletionsWritable(\"340 Wat\")\n\nresp, _, err := suite.apiClient.UsAutocompletionsApi.Autocomplete(suite.ctx).UsAutocompletionsWritable(suite.usAutocomplationsWritable).Execute()\n\nif err != nil {\n return err\n}\n" label: GO components: schemas: zip_code: type: string pattern: ^\d{5}((-)?\d{4})?$ us_autocompletions_writable: type: object required: - address_prefix properties: address_prefix: type: string description: 'Only accepts numbers and street names in an alphanumeric format. ' city: type: string description: 'An optional city input used to filter suggestions. Case insensitive and does not match partial abbreviations. ' state: type: string description: 'An optional state input used to filter suggestions. Case insensitive and does not match partial abbreviations. ' zip_code: type: string description: 'An optional ZIP Code input used to filter suggestions. Matches partial entries. ' geo_ip_sort: type: boolean description: 'If `true`, sort suggestions by proximity to the IP set in the `X-Forwarded-For` header. ' suggestions: type: object required: - primary_line - city - state - zip_code properties: primary_line: type: string description: 'The primary delivery line (usually the street address) of the address. Combination of the following applicable `components` (primary number & secondary information may be missing or inaccurate): * `primary_number` * `street_predirection` * `street_name` * `street_suffix` * `street_postdirection` * `secondary_designator` * `secondary_number` * `pmb_designator` * `pmb_number` ' city: $ref: '#/components/schemas/city' state: $ref: '#/components/schemas/state' zip_code: allOf: - description: 'Must be formatted as a US ZIP or ZIP+4 (e.g. `94107`, `941072282`, `94107-2282`). ' - $ref: '#/components/schemas/zip_code' object: type: string description: Value is resource type. enum: - us_autocompletion default: us_autocompletion city: allOf: - $ref: '#/components/schemas/city_no_description' - type: string description: The name of the city. error: type: object description: Lob uses RESTful HTTP response codes to indicate success or failure of an API request. In general, 2xx indicates success, 4xx indicate an input error, and 5xx indicates an error on Lob's end. required: - error properties: error: type: object required: - message - status_code - code properties: message: type: string description: A human-readable message with more details about the error example: Rate limit exceeded. Please wait 5 seconds and try your request again. status_code: $ref: '#/components/schemas/failure_status_code' code: type: string enum: - bad_request - conflict - feature_limit_reached - internal_server_error - invalid - not_deletable - not_found - request_timeout - service_unavailable - unrecognized_endpoint - unsupported_lob_version - address_length_exceeds_limit - bank_account_already_verified - bank_error - billing_address_required - custom_envelope_inventory_depleted - deleted_bank_account - failed_deliverability_strictness - file_pages_below_min - file_pages_exceed_max - file_size_exceeds_limit - foreign_return_address - inconsistent_page_dimensions - invalid_bank_account - invalid_bank_account_verification - invalid_check_international - invalid_country_covid - invalid_file - invalid_file_dimensions - invalid_file_download_time - invalid_file_url - invalid_image_dpi - invalid_international_feature - invalid_perforation_return_envelope - invalid_template_html - mail_use_type_can_not_be_null - merge_variable_required - merge_variable_whitespace - payment_method_unverified - pdf_encrypted - special_characters_restricted - unembedded_fonts - email_required - invalid_api_key - publishable_key_not_allowed - rate_limit_exceeded - unauthorized - unauthorized_token description: 'A pre-defined string identifying an error. Error codes fall into three categories: **GENERIC** * `bad_request` - 422: an invalid request was made. See error message for details. * `conflict` - 409/422: this operation would leave data in a conflicted state. * `feature_limit_reached` - 403: the account has reached its resource limit and requires upgrading to add more. * `internal_server_error` - 500: an error has occured on Lob''s servers. Please try request again. * `invalid` - 422: an invalid request was made. See error message for details. * `not_deletable` - 422: an attempt was made to delete a resource, but the resource cannot be deleted. * `not_found` - 404: the requested resource was not found. * `request_timeout` - 408: the request took too long. Please try again. * `service_unavailable` - 503: the Lob servers are temporarily unavailable. Please try agian. * `unrecognized_endpoint` - 404: the requested endpoint doesn''t exist. * `unsupported_lob_version` - 422: an unsupported Lob API version was requested. **ADVANCED** * `address_length_exceeds_limit` - 422: the sum of to.address_line1 and to.address_line2 cannot surpass 50 characters. * `bank_account_already_verified` - 422: the bank account has already been verified. * `bank_error` - 422: there''s an issue with the bank account. * `billing_address_required` - 403: in order to create a live mail piece, your account needs to set up a billing address. * `custom_envelope_inventory_depleted` - 422: custom envelope inventory is depleted, and more will need to be ordered. * `deleted_bank_account` - 404: checks cannot be created with a deleted bank account. * `failed_deliverability_strictness` - 422: the `to` address doesn''t meet strictness requirements. See Account Settings to configure strictness. * `file_pages_below_min` - 422: not enough pages. * `file_pages_exceed_max` - 422: too many pages. * `file_size_exceeds_limit` - 422: the file size is too large. See description for details. * `foreign_return_address` - 422: the `from` address must be a US address. * `inconsistent_page_dimensions` - 422: all pages of the input file must have the same dimensions. * `invalid_bank_account` - 422: the provided bank routing number is invalid. * `invalid_bank_account_verification` - 422: verification amounts do not match. * `invalid_check_international` - 422: checks cannot be sent internationally. * `invalid_country_covid` - 422: the postal service in the specified country is currently unable to process the request due to COVID-19 restrictions. * `invalid_file` - 422: the file is invalid. * `invalid_file_dimensions` - 422: file dimensions are incorrect for the selected mail type. * `invalid_file_download_time` - 422: file download from remote server took too long. * `invalid_file_url` - 422: the file URL when creating a resource is invalid. * `invalid_image_dpi` - 422: DPI must be at least 300. * `invalid_international_feature` - 422: the specified product cannot be sent to the destination. * `invalid_perforation_return_envelope` - 422: both `return_envelope` and `perforation` must be used together. * `invalid_template_html` - 422: the provided HTML is invalid. * `mail_use_type_can_not_be_null` - 422: use_type must be one of "marketing" or "operational". Alternatively, an admin can set the account default use type in Account Settings. * `merge_variable_required` - 422: a required merge variable is missing. * `merge_variable_whitespace` - 422: merge variable names cannot contain whitespace. * `payment_method_unverified` - 401: you must have a verified bank account or credit card to submit live requests. * `pdf_encrypted` - 422: an encrypted PDF was provided. * `special_characters_restricted` - 422: cannot use special characters for merge variable names. * `unembedded_fonts` - 422: the provided PDF contains non-standard unembedded fonts. See description for details. **AUTHENTICATION** * `email_required` - 401: account must have a verified email address before creating live resources. * `invalid_api_key` - 401/403: the API key is invalid. * `publishable_key_not_allowed` - 403: the requested operation needs a secret key, not a publishable key. See [API Keys](#section/API-Keys) for more information. * `rate_limit_exceeded` - 429: requests were sent too quickly and must be slowed down. * `unauthorized` - 401: the request isn''t authorized. * `unauthorized_token` - 401: token isn''t authorized. ' us_autocompletions: type: object properties: id: $ref: '#/components/schemas/us_auto_id' suggestions: type: array description: 'An array of objects representing suggested addresses. ' minItems: 0 maxItems: 10 items: $ref: '#/components/schemas/suggestions' object: type: string description: Value is resource type. enum: - us_autocompletion default: us_autocompletion city_no_description: type: string maxLength: 200 state: type: string description: 'The ISO 3166-2 two letter code for the state. ' maxLength: 2 us_auto_id: type: string description: Unique identifier prefixed with `us_auto_`. pattern: ^us_auto_[a-zA-Z0-9]+$ failure_status_code: type: integer enum: - 401 - 403 - 404 - 413 - 422 - 429 - 500 description: "A conventional HTTP status code:\n * `401` - Authorization error with your API key or account\n * `403` - Forbidden error with your API key or account\n * `404` - The requested item does not exist\n * `413` - Payload too large\n * `422` - The query or body parameters did not pass validation\n * `429` - Too many requests have been sent with an API key in a given amount of time\n * `500` - An internal server error occurred, please contact support@lob.com\n" headers: ratelimit-limit: description: The rate limit for a given endpoint. schema: type: integer example: 150 ratelimit-reset: description: 'The time at which the rate limit window resets in UTC epoch seconds ' schema: type: integer example: 1528749846 ratelimit-remaining: description: The number of requests remaining in the current window. schema: type: integer example: 100 responses: us_autocompletions_error: description: Error content: application/json: schema: $ref: '#/components/schemas/error' example: error: code: invalid message: address_prefix is required status_code: 422 us_autocompletions: description: Returns a US autocompletion object. headers: ratelimit-limit: $ref: '#/components/headers/ratelimit-limit' ratelimit-remaining: $ref: '#/components/headers/ratelimit-remaining' ratelimit-reset: $ref: '#/components/headers/ratelimit-reset' content: application/json: schema: $ref: '#/components/schemas/us_autocompletions' examples: basic: value: id: us_auto_a3ac97bcfbb2460ab20c suggestions: - primary_line: 185 BAYSIDE VILLAGE PL city: SAN FRANCISCO state: CA zip_code: '94107' - primary_line: 185 BRANNAN ST city: SAN FRANCISCO state: CA zip_code: '94107' - primary_line: 185 BONIFACIO ST city: SAN FRANCISCO state: CA zip_code: '94107' - primary_line: 185 BLAIR TER city: SAN FRANCISCO state: CA zip_code: '94107' - primary_line: 185 BLUXOME ST city: SAN FRANCISCO state: CA zip_code: '94107' - primary_line: 210 KING ST city: SAN FRANCISCO state: CA zip_code: '94107' - primary_line: 185 BRYANT ST city: SAN FRANCISCO state: CA zip_code: '94107' object: us_autocompletion test: value: id: us_auto_a3ac97bcfbb2460ab20c suggestions: - primary_line: 1 TELEPHONE RD city: OXFORD state: AR zip_code: '72565' - primary_line: 1 TELEGA PL city: PALMDALE state: CA zip_code: '93550' - primary_line: 1 TELEGRAM AVE city: ELMONT state: NY zip_code: '11003' - primary_line: 1 TELEGRAM AVE city: GARDEN CITY state: KS zip_code: '67846' - primary_line: 1 TELEGRAPH HILL RD city: HOLMDEL state: NJ zip_code: '07733' - primary_line: 1 TELEGRAPH HILL RD S city: HOLMDEL state: NJ zip_code: '07733' - primary_line: 1 TELEGRAPH HILL BLVD city: SAN FRANCISCO state: CA zip_code: '94133' object: us_autocompletion securitySchemes: basicAuth: type: http scheme: basic x-webhooks: events: post: summary: Events description: Information about an event operationId: event tags: - Events responses: '200': $ref: '#/components/responses/events' tracking_events: post: summary: Tracking Events description: Information about tracking events operationId: tracking_event tags: - Tracking Events responses: '200': $ref: '#/components/responses/tracking_events' x-tagGroups: - name: Overview tags: - Introduction - Authentication - Getting Started - SDKs and Tools - name: Address Book tags: - Addresses - National Change of Address - name: Print and Mail API tags: - Postcards - Self Mailers - Letters - Checks - Snap Packs - Booklets - Bank Accounts - Templates - Template Versions - Template Design - Manage Mail - name: Campaigns API (BETA) tags: - Campaigns - Creatives - Uploads - name: Informed Delivery Campaign API tags: - Informed Delivery Campaign - name: Address Verification API tags: - US Verifications - US Verification Types - US Autocompletions - Reverse Geocode Lookups - Zip Lookups - Identity Validation - Intl Verifications - name: Webhooks tags: - Webhooks - Events - Tracking Events - name: Special Features tags: - Billing Groups - Buckslips - Buckslip Orders - Cards - Card Orders - QR Codes - URL Shortener - name: Appendix tags: - Beta Program - Errors - Rate Limiting - Requests and Responses - Test and Live Environments - Versioning and Changelog