> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.mycargoextra.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.mycargoextra.com/_mcp/server.

# List User Addresses

GET http://localhost:9000/api/v1/address

Lists addresses owned by the authenticated customer.

Response fields: `message`, `data[]`, `pagination`. Address fields include `_id`, `company`, `email`, `phone`, `address1`, `address2`, `city`, `state`, `country`, `zipCode`, `default`, `customerId`, `createdAt`, `updatedAt`.

Possible errors:
- 400: Invalid address Id - path id is not a valid Mongo ObjectId.
- 404: Address not found or not authorized - address does not exist or belongs to another customer.
- 409: Address already exists - duplicate address detected.
- 400: Default address cannot be deleted - unset/change default first.
- 400: Missing One or More Required Parameters - required body/query fields were not supplied.
- 401: Unauthorized - token is missing, expired, invalid, or the account/token pair was not found.
- 403: Access denied - gateway traffic guard/rate policy blocked the request.
- 429: Too many requests - gateway rate limit exceeded.
- 500: Unexpected Error - unhandled gateway or downstream service failure.

Reference: https://docs.mycargoextra.com/cargo-extra-gateway-api-copy/address/list-user-addresses

## OpenAPI Specification

```yaml
openapi: 3.1.0
info:
  title: collection
  version: 1.0.0
paths:
  /api/v1/address:
    get:
      operationId: list-user-addresses
      summary: List User Addresses
      description: >-
        Lists addresses owned by the authenticated customer.


        Response fields: `message`, `data[]`, `pagination`. Address fields
        include `_id`, `company`, `email`, `phone`, `address1`, `address2`,
        `city`, `state`, `country`, `zipCode`, `default`, `customerId`,
        `createdAt`, `updatedAt`.


        Possible errors:

        - 400: Invalid address Id - path id is not a valid Mongo ObjectId.

        - 404: Address not found or not authorized - address does not exist or
        belongs to another customer.

        - 409: Address already exists - duplicate address detected.

        - 400: Default address cannot be deleted - unset/change default first.

        - 400: Missing One or More Required Parameters - required body/query
        fields were not supplied.

        - 401: Unauthorized - token is missing, expired, invalid, or the
        account/token pair was not found.

        - 403: Access denied - gateway traffic guard/rate policy blocked the
        request.

        - 429: Too many requests - gateway rate limit exceeded.

        - 500: Unexpected Error - unhandled gateway or downstream service
        failure.
      tags:
        - subpackage_address
      parameters:
        - name: page
          in: query
          description: Query parameter supported by the gateway/downstream service.
          required: false
          schema:
            type: integer
        - name: limit
          in: query
          description: Query parameter supported by the gateway/downstream service.
          required: false
          schema:
            type: integer
        - name: sortBy
          in: query
          description: Query parameter supported by the gateway/downstream service.
          required: false
          schema:
            type: string
        - name: sortOrder
          in: query
          description: Query parameter supported by the gateway/downstream service.
          required: false
          schema:
            type: string
        - name: q
          in: query
          description: Query parameter supported by the gateway/downstream service.
          required: false
          schema:
            type: string
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/address_List User Addresses_Response_200'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetApiV1AddressRequestBadRequestError'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetApiV1AddressRequestUnauthorizedError'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetApiV1AddressRequestForbiddenError'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetApiV1AddressRequestNotFoundError'
        '409':
          description: Conflict
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetApiV1AddressRequestConflictError'
        '429':
          description: Too Many Requests
          content:
            application/json:
              schema:
                $ref: >-
                  #/components/schemas/GetApiV1AddressRequestTooManyRequestsError
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetApiV1AddressRequestInternalServerError'
servers:
  - url: http://localhost:9000
    description: http://localhost:9000
components:
  schemas:
    address_List User Addresses_Response_200:
      type: object
      properties:
        key_0:
          type: integer
        key_1:
          type: string
        key_2:
          type: number
          format: double
        key_3:
          type: string
        key_4:
          type: boolean
      required:
        - key_0
        - key_1
        - key_2
        - key_3
        - key_4
      title: address_List User Addresses_Response_200
    GetApiV1AddressRequestBadRequestError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: GetApiV1AddressRequestBadRequestError
    GetApiV1AddressRequestUnauthorizedError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: GetApiV1AddressRequestUnauthorizedError
    GetApiV1AddressRequestForbiddenError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: GetApiV1AddressRequestForbiddenError
    GetApiV1AddressRequestNotFoundError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: GetApiV1AddressRequestNotFoundError
    GetApiV1AddressRequestConflictError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: GetApiV1AddressRequestConflictError
    GetApiV1AddressRequestTooManyRequestsError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: GetApiV1AddressRequestTooManyRequestsError
    GetApiV1AddressRequestInternalServerError:
      type: object
      properties:
        message:
          type: string
      required:
        - message
      title: GetApiV1AddressRequestInternalServerError

```

## Examples



**Request**

```json
{}
```

**Response**

```json
{
  "message": "Addresses retrieved successfully.",
  "data": [
    {
      "_id": "642f1b2e9f1b8a3c4d5e6f70",
      "company": "Acme Corporation",
      "email": "contact@acmecorp.com",
      "phone": "+1-555-123-4567",
      "address1": "123 Elm Street",
      "address2": "Suite 400",
      "city": "Springfield",
      "state": "IL",
      "country": "USA",
      "zipCode": "62704",
      "default": true,
      "customerId": "5f8d0d55b54764421b7156c3",
      "createdAt": "2024-04-10T09:15:00Z",
      "updatedAt": "2024-04-15T11:20:00Z"
    },
    {
      "_id": "642f1b2e9f1b8a3c4d5e6f71",
      "company": "Beta Logistics",
      "email": "support@betalogistics.com",
      "phone": "+1-555-987-6543",
      "address1": "456 Oak Avenue",
      "address2": "",
      "city": "Metropolis",
      "state": "NY",
      "country": "USA",
      "zipCode": "10001",
      "default": false,
      "customerId": "5f8d0d55b54764421b7156c3",
      "createdAt": "2024-03-22T14:30:00Z",
      "updatedAt": "2024-04-01T08:45:00Z"
    }
  ],
  "pagination": {
    "page": 1,
    "limit": 20,
    "totalPages": 1,
    "totalItems": 2
  }
}
```

**SDK Code**

```python address_List User Addresses_example
import requests

url = "http://localhost:9000/api/v1/address"

querystring = {"page":"1","limit":"20","sortBy":"createdAt","sortOrder":"desc","q":""}

payload = {}
headers = {"Content-Type": "application/json"}

response = requests.get(url, json=payload, headers=headers, params=querystring)

print(response.json())
```

```javascript address_List User Addresses_example
const url = 'http://localhost:9000/api/v1/address?page=1&limit=20&sortBy=createdAt&sortOrder=desc&q=';
const options = {method: 'GET', headers: {'Content-Type': 'application/json'}, body: '{}'};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go address_List User Addresses_example
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "http://localhost:9000/api/v1/address?page=1&limit=20&sortBy=createdAt&sortOrder=desc&q="

	payload := strings.NewReader("{}")

	req, _ := http.NewRequest("GET", url, payload)

	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby address_List User Addresses_example
require 'uri'
require 'net/http'

url = URI("http://localhost:9000/api/v1/address?page=1&limit=20&sortBy=createdAt&sortOrder=desc&q=")

http = Net::HTTP.new(url.host, url.port)

request = Net::HTTP::Get.new(url)
request["Content-Type"] = 'application/json'
request.body = "{}"

response = http.request(request)
puts response.read_body
```

```java address_List User Addresses_example
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.get("http://localhost:9000/api/v1/address?page=1&limit=20&sortBy=createdAt&sortOrder=desc&q=")
  .header("Content-Type", "application/json")
  .body("{}")
  .asString();
```

```php address_List User Addresses_example
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'http://localhost:9000/api/v1/address?page=1&limit=20&sortBy=createdAt&sortOrder=desc&q=', [
  'body' => '{}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp address_List User Addresses_example
using RestSharp;

var client = new RestClient("http://localhost:9000/api/v1/address?page=1&limit=20&sortBy=createdAt&sortOrder=desc&q=");
var request = new RestRequest(Method.GET);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift address_List User Addresses_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "http://localhost:9000/api/v1/address?page=1&limit=20&sortBy=createdAt&sortOrder=desc&q=")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```