---
title: "POST /v1/projects/{projectsId}/schemas:validateMessage"
method: POST
path: "/v1/projects/{projectsId}/schemas:validateMessage"
tags: ["projects"]
---

# POST /v1/projects/{projectsId}/schemas:validateMessage

`POST /v1/projects/{projectsId}/schemas:validateMessage`

## Request

- Base URL: `https://pubsub.googleapis.com`
- URL: `https://pubsub.googleapis.com/v1/projects/{projectsId}/schemas:validateMessage`
- Auth: one of:
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/cloud-platform`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/cloud-platform`
  - OAuth 2 and OAuth 2
    - Implicit: `https://accounts.google.com/o/oauth2/auth`
    - Scopes: `https://www.googleapis.com/auth/pubsub`
    - Authorization code: `https://accounts.google.com/o/oauth2/auth`
    - Token URL: `https://accounts.google.com/o/oauth2/token` scopes: `https://www.googleapis.com/auth/pubsub`

Validates a message against a schema.

## Path parameters

- `projectsId` string, required

## Query parameters

- `$.xgafv` '1' | '2'
- `access_token` string
- `alt` 'json' | 'media' | 'proto'
- `callback` string
- `fields` string
- `key` string
- `oauth_token` string
- `prettyPrint` boolean
- `quotaUser` string
- `uploadType` string
- `upload_protocol` string

## Request body

- ValidateMessageRequest: Request for the `ValidateMessage` method.
  - `encoding` 'ENCODING_UNSPECIFIED' | 'JSON' | 'BINARY': The encoding expected for messages
  - `message` string, byte: Message to validate against the provided `schema_spec`.
  - `name` string: Name of the schema against which to validate. Format is `projects/{project}/schemas/{schema}`.
  - `schema` Schema: A schema resource.
    - `compiledProtoSchema` CompiledProtoSchema: Configuration specific to compiled Protocol Buffer schemas.
      - `compiledBytes` string, byte: Required. The compiled FileDescriptorSet binary.
      - `rootMessage` string: Required. The name of the root message type in the schema.
    - `definition` string: The definition of the schema. This should contain a string representing the full definition of the schema that is a valid schema definition of the type specified in `type`.
    - `name` string: Required. Name of the schema. Format is `projects/{project}/schemas/{schema}`.
    - `revisionCreateTime` string, google-datetime: Output only. The timestamp that the revision was created.
    - `revisionId` string: Output only. Immutable. The revision ID of the schema.
    - `type` 'TYPE_UNSPECIFIED' | 'PROTOCOL_BUFFER' | 'AVRO': The type of the schema definition.

## Response `200`

Successful response

- ValidateMessageResponse: Response for the `ValidateMessage` method. Empty for now.

## Changes

- **2026-11-11** `5eea47510ec8`: 4 info
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was added to the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/cloud-platform` was added to the endpoint's security scheme `Oauth2c`
  - the security scope `https://www.googleapis.com/auth/pubsub` was removed from the endpoint's security scheme `Oauth2`
  - the security scope `https://www.googleapis.com/auth/pubsub` was removed from the endpoint's security scheme `Oauth2c`

[Operation history](https://skmtc.dev/google/apis/pubsub/changes/v1/projects/:projectsId/schemas:validateMessage/post.md)

---

[API](https://skmtc.dev/google/apis/pubsub.md) - [All operations](https://skmtc.dev/google/apis/pubsub/llms.txt) - [OpenAPI document](https://skmtc.dev/google/apis/pubsub/revisions/5eea47510ec8?raw)
