> ## Documentation Index
> Fetch the complete documentation index at: https://sendcloud.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Validate an address

> Validate a shipping address before you use it in a shipment.

> [!NOTE]
>
> OAuth2 scopes required: `write:parcel`. See [Scopes for OAuth apps](https://sendcloud.dev/api/v3/scopes.md).

By validating addresses in advance, you can ensure that the shipping information is accurate and complete,
reducing the risk of delivery issues and improving overall shipping efficiency.
Providing the carrier helps to tailor the address validation process according to specific carrier requirements.
Using additional validation methods can further enhance the accuracy of the address verification.

The default Sendcloud validation is always applied and has 2 steps:

1. checks the address against the carrier limits
   (e.g. maximum length of the address line, existence of the postal code for the country, etc.).
   See also [Carrier address limits](https://sendcloud.dev/docs/addresses/address-field-limits.md#address-field-limits).

2. optimizes (washes) the address to fit within the carrier limits.
   (e.g. deduplication of address lines, abbreviations, etc.)


## OpenAPI

````yaml /.openapi/v3/shipments/openapi.yaml post /addresses/validate
openapi: 3.1.0
info:
  title: Shipments
  version: 3.0.0
  description: >-
    The Shipments API allows you to create and announce, retrieve, and cancel
    outgoing shipments and their associated parcels within the Sendcloud
    platform.
  contact:
    name: Sendcloud API Support
    email: contact@sendcloud.com
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
servers:
  - url: https://panel.sendcloud.sc/api/v3
    description: Sendcloud Production
security: []
tags:
  - name: Shipments
    description: Shipments API
paths:
  /addresses/validate:
    post:
      tags:
        - Address
        - Returns
        - Shipments
      summary: Validate an address
      description: Validate a shipping address before you use it in a shipment.
      operationId: sc-public-v3-scp-post-validate_address
      parameters:
        - schema:
            type: string
            example: 550e8400-e29b-41d4-a716-446655440000
          in: header
          description: >-
            If you are <a href="https://www.sendcloud.com/ecosystem/"
            target="_blank"> an official Sendcloud Tech Partner</a>, you can
            provide this additional request header for the system to recognize
            you. Sendcloud Partner UUID is provided to Sendcloud partners. The
            token is not required but if the header is set, the system will try
            to validate it. An unknown UUID will cause the 404 return, whilst an
            invalid one will return 400.
          name: Sendcloud-Partner-Id
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/address-washer-request'
      responses:
        '200':
          description: Address validation successful
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/address-washer-response'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/errors'
              examples:
                Failed:
                  summary: Failed to validate the address
                  value:
                    errors:
                      - detail: This field is required.
                        status: '400'
                        source:
                          pointer: /address/carrier_code
                        code: required
      security:
        - HTTPBasicAuth: []
        - OAuth2ClientCreds:
            - write:parcel
components:
  schemas:
    address-washer-request:
      title: Address Washer Request
      description: Address Washer Request object model
      type: object
      properties:
        address:
          $ref: '#/components/schemas/raw-address'
        carrier_code:
          description: >-
            The code of the carrier to be used for the address validation. Only
            carriers available to your account can be used.
          type: string
          example: trunkrs
        validation_methods:
          description: |
            An array of optional address validation methods to be applied.
            The default Sendcloud validation will always be applied.
          type: array
          items:
            $ref: '#/components/schemas/address-validation-method-enum'
          example:
            - here
      required:
        - address
        - carrier_code
    address-washer-response:
      title: Address Washer Response
      description: Address Washer Response object model
      type: object
      properties:
        input_address_is_valid:
          anyOf:
            - type: boolean
            - type: 'null'
          description: >-
            Indicates if the input address is valid. In case null is returned,
            the address is not valid and the details are not available (e.g.,
            the address validator is not available).
        results:
          description: The results of the address validation.
          type: array
          items:
            type: object
            properties:
              address:
                description: >-
                  The validated address details. In case null is returned, the
                  address is not valid and the details are not available (e.g.,
                  the address validator is not available).
                anyOf:
                  - $ref: '#/components/schemas/raw-address'
                  - type: 'null'
              validation_method:
                description: >-
                  The method used for address validation, null stands for the
                  Sendcloud address carrier optimizer validation method.
                anyOf:
                  - $ref: '#/components/schemas/address-validation-method-enum'
                  - type: 'null'
              recommended:
                type: boolean
                description: Indicates if the address is recommended after validation.
              analysis:
                anyOf:
                  - type: object
                    description: >-
                      Analysis details of the address validation process. In
                      case null is returned no analysis details are available.
                    properties:
                      validation_result:
                        type: object
                        description: The result of the validation process.
                        properties:
                          is_valid:
                            type: boolean
                            description: Indicates if the address is valid.
                          reasons:
                            type: array
                            description: List of reasons for the validation result.
                            items:
                              type: string
                              oneOf:
                                - const: ADDRESS_TOO_LONG
                                  title: address_lines:too_long
                                  description: The address line exceeds the maximum length.
                                - const: HOUSE_NUMBER_TOO_LONG
                                  title: house_number:too_long
                                  description: The house number exceeds the maximum length.
                                - const: HOUSE_NUMBER_TOO_SHORT
                                  title: house_number:too_short
                                  description: The house number is too short.
                                - const: ADDRESS_NOT_VALID
                                  title: address:does_not_exist
                                  description: The address does not exist.
                                - const: COUNTRY_CODE_MISSING
                                  title: country_code:missing
                                  description: The country code is missing.
                                - const: POSTAL_CODE_MISSING
                                  title: postal_code:missing
                                  description: The postal code is missing.
                                - const: STATE_MISSING
                                  title: state:missing
                                  description: The state is missing.
                                - const: PROVINCE_MISSING
                                  title: province:missing
                                  description: The province is missing.
                      changed_attributes:
                        type: array
                        description: List of changed attributes.
                        items:
                          type: string
                      invalid_attributes:
                        type: array
                        description: >-
                          List of attributes that are invalid (i.e. below the
                          field-level validation threshold).
                        items:
                          type: string
                  - type: 'null'
    errors:
      title: Errors
      description: >-
        A standardized format for errors in
        [JSON:API](https://jsonapi.org/format/#error-objects) responses.
      type: array
      items:
        allOf:
          - $ref: '#/components/schemas/ErrorObject'
          - required:
              - status
              - code
              - detail
    raw-address:
      title: Raw address
      type: object
      description: Raw address object
      properties:
        address_line_1:
          type: string
          example: Stadhuisplein
          description: First line of the address
        house_number:
          type: string
          example: '50'
          description: House number of the address
        address_line_2:
          type: string
          description: Additional address information, e.g. 2nd level
          example: Apartment 17B
        postal_code:
          type: string
          example: 1013 AB
          description: Zip code of the address
          minLength: 1
        city:
          type: string
          example: Eindhoven
          description: City of the address
          minLength: 1
        po_box:
          type:
            - string
            - 'null'
          description: Code required in case of PO Box or post locker delivery
        state_province_code:
          type: string
          example: IT-RM
          description: >-
            The character state code of the customer represented as ISO 3166-2
            code. This field is required for certain countries. See
            [international
            shipping](/docs/shipments/international-shipping#required-fields-for-international-shipments)
            for details.
        country_code:
          type: string
          example: NL
          description: The country code of the customer represented as ISO 3166-1 alpha-2
          minLength: 1
    address-validation-method-enum:
      title: Address validation method enum
      type: string
      enum:
        - here
    ErrorObject:
      title: Error
      type: object
      description: Error in a JSON:API error format
      properties:
        id:
          type: string
          description: A unique identifier for the error.
        links:
          type: object
          description: >-
            A set of hyperlinks that provide additional information about the
            error.
          properties:
            about:
              type: string
              description: A URL that provides additional information about the error.
        status:
          type: string
          format: int32
          description: The HTTP status code of the error.
          minLength: 1
        code:
          type: string
          description: A unique error code for the error, in snake case format.
          minLength: 1
          enum:
            - unknown_field
            - invalid
            - forbidden
            - invalid_choice
            - min_value
            - 'null'
            - not_found
            - required
            - not_a_list
            - non_field_errors
            - authentication_failed
            - validation_error
            - parcel_announcement_error
        title:
          type: string
          description: A short, human-readable summary of the error.
          minLength: 1
        detail:
          type: string
          description: A human-readable explanation of the error.
          minLength: 1
        source:
          type: object
          description: >-
            An object that identifies the source of the error within the request
            payload.
          properties:
            pointer:
              type: string
              description: >-
                A `JSON` pointer to the location of the error within the request
                payload.
            parameter:
              type: string
              description: The name of the `query` parameter that caused the error.
            header:
              type: string
              description: The name of the `header` parameter that caused the error.
        meta:
          type: object
          description: Additional metadata about the error.
  securitySchemes:
    HTTPBasicAuth:
      type: http
      description: >-
        Basic Authentication using API key and secrets is currently the main
        authentication mechanism.
      scheme: basic
    OAuth2ClientCreds:
      type: oauth2
      description: >-
        OAuth2 is a standardized protocol for authorization that allows users to
        share their private resources stored on one site with another site
        without having to provide their credentials. OAuth2 Client Credentials
        Grant workflow. This workflow is typically used for server-to-server
        interactions that require authorization to access specific resources.
      flows:
        clientCredentials:
          tokenUrl: https://account.sendcloud.com/oauth2/token/
          scopes:
            read:analytics: View your shipping analytics
            read:audit-log: View your account's audit log
            read:brand: View your brands
            write:brand: Manage your brands
            write:carrier: Configure carriers and contracts
            read:checkout: View your dynamic checkout configurations and templates
            read:event-subscription: View your event subscriptions
            write:event-subscription: Create and manage your event subscriptions
            read:integration: View your integrations
            write:integration: Connect and manage integrations
            read:invoice: View your invoices
            read:notification: View your notifications
            write:notification: Manage your notifications
            read:operational-settings: >-
              View your warehouses, shipping lanes, and other operational
              settings
            write:operational-settings: >-
              Manage your warehouses, shipping lanes, and other operational
              settings
            read:order: View your orders
            write:order: Import and process your orders
            read:organization: View organization settings
            write:organization: Change organization settings
            read:parcel: View your shipments and their tracking status
            write:parcel: Create, announce, and cancel shipments
            read:pickup: View carrier pickups and the options available for scheduling them
            write:pickup: Schedule and manage carrier pickups
            read:price: View shipping prices
            write:product: Manage your product catalog
            read:return: View your returns
            write:return: Create and manage returns
            read:return-settings: View your return settings
            write:return-settings: Configure your return settings
            read:service-point: View carrier service points
            read:shipping-method: View shipping methods, products and prices
            read:shipping-rule: View your shipping rules
            write:shipping-rule: Create and manage shipping rules
            read:support-ticket: View your support tickets
            write:support-ticket: Manage your support tickets
            read:tracking-message: View your tracking notifications
            write:tracking-message: Manage your tracking notifications
            read:tracking-page: View your tracking page
            write:tracking-page: Customize your tracking page
            read:user: Read your basic account information

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.