---
title: "Validate Postal Codes"
method: POST
path: "/validate_postal_codes"
tags: ["Strategy Parameters"]
---

# Validate Postal Codes

`POST /validate_postal_codes`

## Request

- Base URL: `https://api.mediamath.com/api/v3.0`
- URL: `https://api.mediamath.com/api/v3.0/validate_postal_codes`
- Auth: OAuth 2
  - Authorization code: `https://auth.mediamath.com/authorize`
  - Token URL: `https://auth.mediamath.com/oauth/token` scopes: `offline_access`, `manage:services`
- TypeScript: <https://skmtc.dev/mediamath/apis/campaigns-api/docs/validate_postal_codes/post.ts> (a function with typed inputs; its response is checked against the schema)

Validates a list of postal codes. 

Input is `multipart/form-data` using either:
- `file`: an uploaded CSV or newline-separated file of postal codes.
- `content`: raw CSV or newline-separated text in the request body.

If both are provided, `file` takes precedence and `content` is ignored.
Duplicate codes are deduplicated before validation.

Returns HTTP 200 when all codes are valid, HTTP 400 if any are invalid or
the request is malformed, HTTP 415 if the content-type is not multipart/form-data.
Invalid entries include the line number, character position, original value,
and normalized form to aid correction.

## Request body `multipart/form-data`

- union
  - object
    - `file` string, binary, required: CSV or newline-separated file of postal codes. Takes precedence over `content` if both are provided.
    - `content` string: Raw CSV or newline-separated postal codes. Used only when `file` is not provided.
  - object
    - `file` string, binary: CSV or newline-separated file of postal codes. Takes precedence over `content` if both are provided.
    - `content` string, required: Raw CSV or newline-separated postal codes. Used only when `file` is not provided.

## Response `200`

All postal codes are valid.

- ValidatePostalCodesSuccess
  - `status` object, required
    - `code` string, required

## Other responses

- `400`: One or more postal codes are invalid, or the request itself is malformed. Two response shapes are possible: - `validate_postal_codes_error`: returned when codes are submitted but fail validation. - `error_response`: returned for input errors (missing file/content, wrong content-type, etc.).
- `401`: Error response
- `403`: Error response
- `415`: Error response

---

[API](https://skmtc.dev/mediamath/apis/campaigns-api.md) - [All operations](https://skmtc.dev/mediamath/apis/campaigns-api/llms.txt) - [OpenAPI document](https://skmtc.dev/mediamath/apis/campaigns-api/revisions/408743891def?raw)
