---
title: "Ingest logs from a GCP Pub/Sub push subscription"
method: POST
path: "/gcp/{org_id}/{stream_name}/_sub"
tags: ["Logs"]
---

# Ingest logs from a GCP Pub/Sub push subscription

`POST /gcp/{org_id}/{stream_name}/_sub`

## Request

- Base URL: `https://api.openobserve.ai` (the document declares no server; this is the origin it was published from)
- URL: `https://api.openobserve.ai/gcp/{org_id}/{stream_name}/_sub`
- Auth: API key in query parameter `API-Key`
- TypeScript: <https://skmtc.dev/openobserve/apis/openobserve-api-http/docs/gcp/:org_id/:stream_name/_sub/post.ts> (a function with typed inputs; its response is checked against the schema)

## Path parameters

- `org_id` string, required
- `stream_name` string, required

## Request body

- object
  - `message` GCPMessage, required
    - `attributes` GCPAttributes, required
      - `logging.googleapis.com/timestamp` string, required
    - `data` string, required
    - `messageId` string, required
    - `message_id` string, required
    - `publishTime` string, required
    - `publish_time` string, required
  - `subscription` string, required

## Response `200`

Success

- IngestionResponse
  - `code` integer, required
  - `error` string, nullable
  - `status` StreamStatus[]
    - `error` string
    - `failed` integer, required
    - `successful` integer, required
    - `name` string, required

## Other responses

- `400`: Request rejected, or no record stored because the message was rejected
- `500`: Write to storage failed, or the stream started deleting mid-write

---

[API](https://skmtc.dev/openobserve/apis/openobserve-api-http.md) - [All operations](https://skmtc.dev/openobserve/apis/openobserve-api-http/llms.txt) - [OpenAPI document](https://skmtc.dev/openobserve/apis/openobserve-api-http/revisions/0529b8a10252?raw)
