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

# Update an address book entry

> Change one or more fields of an address book entry.

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

Only the fields you send are changed. Send `"state_province_code": null` to remove the state. No other field accepts `null`.

The complete address, including the fields you did not send, is validated again before it is saved. If a stored field no longer passes validation, for example a missing house number for a Dutch address, include a corrected value for that field in the same request.

When you change the `country_code` without sending a `state_province_code`, the stored state is removed, because it belongs to the previous country.

Fields that are not listed below, including `id`, are rejected. Remove `id` before you send back an entry you retrieved.


## OpenAPI

````yaml /.openapi/v3/address-book/openapi.yaml patch /addresses/address-book/{id}
openapi: 3.1.0
info:
  title: Address book API
  version: 3.0.0
  description: >
    The address book stores the addresses of the people and companies you ship
    to and receive shipments from. An entry is added when you choose to save the
    recipient or sender as a contact while creating a shipment in the Sendcloud
    platform, and you can manage the entries yourself with this API.
  contact:
    name: Sendcloud API Support
    url: https://www.sendcloud.dev
    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: Address Book
paths:
  /addresses/address-book/{id}:
    parameters:
      - schema:
          type: integer
          example: 1
        name: id
        in: path
        required: true
        description: The unique identifier of the address book entry
    patch:
      tags:
        - Address Book
      summary: Update an address book entry
      description: Change one or more fields of an address book entry.
      operationId: sc-public-v3-scp-patch-address_book_address
      requestBody:
        required: true
        content:
          application/json:
            schema:
              unevaluatedProperties: false
              allOf:
                - $ref: '#/components/schemas/AddressBookEntryFields'
            examples:
              UpdateAddressBookEntry:
                summary: Change the name and email address
                value:
                  name: Jane Doe
                  email: janedoe@example.com
      responses:
        '200':
          $ref: '#/components/responses/AddressBookEntry'
        '400':
          $ref: '#/components/responses/ValidationError'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound'
      security:
        - HTTPBasicAuth: []
        - OAuth2ClientCreds:
            - write:address-book
components:
  schemas:
    AddressBookEntryFields:
      type: object
      description: >-
        The fields of an address book entry. Leading and trailing whitespace is
        removed from all text fields.
      properties:
        name:
          type: string
          description: Name of the person
          minLength: 1
          maxLength: 75
          example: John Doe
        company_name:
          type: string
          description: Name of the company
          maxLength: 50
          example: Sendcloud
        email:
          type: string
          description: A valid email address, or an empty string for none
          maxLength: 511
          example: johndoe@example.com
        phone_number:
          type: string
          description: Phone number
          maxLength: 20
          example: '+31612345678'
        address_line_1:
          type: string
          description: First line of the address, usually the street name
          minLength: 1
          maxLength: 150
          example: Stadhuisplein
        house_number:
          type: string
          description: >-
            House number. Required in countries that need one, such as the
            Netherlands. Do not repeat it in `address_line_1`.
          maxLength: 20
          example: '10'
        address_line_2:
          type: string
          description: Additional address information, such as an apartment number
          maxLength: 150
          example: ''
        postal_code:
          type: string
          description: Postal code. It must match the format of the country.
          minLength: 1
          maxLength: 12
          example: 5611 EM
        city:
          type: string
          description: City
          minLength: 1
          maxLength: 30
          example: Eindhoven
        country_code:
          type: string
          description: Country code as ISO 3166-1 alpha-2
          example: NL
        state_province_code:
          type:
            - string
            - 'null'
          description: >-
            State or province code as ISO 3166-2, for example `US-FL`. It must
            belong to the `country_code`.
          example: null
    AddressBookEntry:
      type: object
      description: >-
        An entry in your address book. Entries saved from shipments can hold
        values that the create and update endpoints would reject, such as an
        empty postal code.
      properties:
        id:
          type: integer
          description: The unique identifier of the address book entry
          readOnly: true
          example: 1
        name:
          type: string
          description: Name of the person
          example: John Doe
        company_name:
          type: string
          description: Name of the company
          example: Sendcloud
        email:
          type: string
          description: Email address
          example: johndoe@example.com
        phone_number:
          type: string
          description: Phone number
          example: '+31612345678'
        address_line_1:
          type: string
          description: First line of the address, usually the street name
          example: Stadhuisplein
        house_number:
          type: string
          description: House number
          example: '10'
        address_line_2:
          type: string
          description: Additional address information, such as an apartment number
          example: ''
        postal_code:
          type: string
          description: Postal code
          example: 5611 EM
        city:
          type: string
          description: City
          example: Eindhoven
        country_code:
          type: string
          description: Country code as ISO 3166-1 alpha-2
          example: NL
        state_province_code:
          type:
            - string
            - 'null'
          description: State or province code as ISO 3166-2
          example: null
      required:
        - id
        - name
        - company_name
        - email
        - phone_number
        - address_line_1
        - house_number
        - address_line_2
        - postal_code
        - city
        - country_code
        - state_province_code
    errors:
      title: Errors
      type: object
      description: A standardized format for errors in JSON:API responses.
      properties:
        errors:
          type:
            - array
            - object
          items:
            type: object
            allOf:
              - $ref: '#/components/schemas/ErrorObject'
            required:
              - status
              - code
              - detail
    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.
  responses:
    AddressBookEntry:
      description: The address book entry.
      content:
        application/json:
          schema:
            type: object
            properties:
              data:
                $ref: '#/components/schemas/AddressBookEntry'
    ValidationError:
      description: The request is invalid.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/errors'
          examples:
            MissingHouseNumber:
              summary: A house number is required in this country
              value:
                errors:
                  - status: '400'
                    code: validation_error
                    detail: This field cannot be blank.
                    source:
                      pointer: /house_number
    Unauthorized:
      description: The request has no valid credentials.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/errors'
          examples:
            Unauthorized:
              summary: Not authenticated
              value:
                errors:
                  - status: '401'
                    code: not_authenticated
                    detail: Unauthorized
    Forbidden:
      description: >-
        The credentials lack the required scope, `read:address-book` to read or
        `write:address-book` to make changes.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/errors'
          examples:
            Forbidden:
              summary: Missing scope
              value:
                errors:
                  - status: '403'
                    code: forbidden
                    detail: You do not have permission to perform this action.
    NotFound:
      description: The address book entry does not exist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/errors'
          examples:
            NotFound:
              summary: Not found
              value:
                errors:
                  - status: '404'
                    code: not_found
                    detail: Not found
  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:address-book: View your address book
            write:address-book: Manage your address book
            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.