Google Cloud Trace Projects API

The Projects API from Google Cloud Trace — 4 operation(s) for projects.

GitHub OpenAPI
Business capability
Observability Management BC-4220.20

Operations 2

POST /v2/projects/{projectsId}/traces:batchWrite Batch write traces #
POST /v2/projects/{projectsId}/traces/{tracesId}/spans/{spansId} Create span spans #

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/google-cloud-trace:google-cloud-trace-projects-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Calls without X-API-Key need no key. Calls with it need a paid plan — get a key.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. By signing up you are subscribing to the APIs.io and API Evangelist newsletters — you can unsubscribe from any issue. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

OpenAPI Specification

google-cloud-trace-projects-api-openapi.yml Raw ↑
openapi: 3.2.0
info:
  title: Cloud Trace Projects API
  version: v2
  description: Generated from Google's published Discovery document for Cloud Trace API (cloudtrace v2, revision 20261106). 2 operation(s).
  contact:
    name: Google
    url: https://developers.google.com/
  termsOfService: https://developers.google.com/terms
servers:
- url: https://cloudtrace.googleapis.com
tags:
- name: Projects
paths:
  /v2/projects/{projectsId}/traces:batchWrite:
    post:
      operationId: cloudtrace.projects.traces.batchWrite
      summary: Batch write traces
      description: Batch writes new spans to new or existing traces. You cannot update existing spans. If a span ID already exists, an additional copy of the span will be stored.
      parameters:
      - name: projectsId
        in: path
        required: true
        description: Resource name segment (projectsId).
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/BatchWriteSpansRequest'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Empty'
        4XX:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GoogleRpcError'
          description: 'Client error (google.rpc.Status: INVALID_ARGUMENT, PERMISSION_DENIED, NOT_FOUND ...)'
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GoogleRpcError'
          description: Error response (google.rpc.Status)
      security:
      - oauth2:
        - https://www.googleapis.com/auth/cloud-platform
        - https://www.googleapis.com/auth/trace.append
      - apiKey: []
      tags:
      - Projects
  /v2/projects/{projectsId}/traces/{tracesId}/spans/{spansId}:
    post:
      operationId: cloudtrace.projects.traces.spans.createSpan
      summary: Create span spans
      description: Creates a new span. If a span ID already exists, an additional copy of the span will be stored.
      parameters:
      - name: projectsId
        in: path
        required: true
        description: Resource name segment (projectsId).
        schema:
          type: string
      - name: tracesId
        in: path
        required: true
        description: Resource name segment (tracesId).
        schema:
          type: string
      - name: spansId
        in: path
        required: true
        description: Resource name segment (spansId).
        schema:
          type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/Span'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Span'
        4XX:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GoogleRpcError'
          description: 'Client error (google.rpc.Status: INVALID_ARGUMENT, PERMISSION_DENIED, NOT_FOUND ...)'
        default:
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GoogleRpcError'
          description: Error response (google.rpc.Status)
      security:
      - oauth2:
        - https://www.googleapis.com/auth/cloud-platform
        - https://www.googleapis.com/auth/trace.append
      - apiKey: []
      tags:
      - Projects
components:
  schemas:
    Annotation:
      type: object
      description: Text annotation with a set of attributes.
      properties:
        attributes:
          $ref: '#/components/schemas/Attributes'
          description: Optional. A set of attributes on the annotation. You can have up to 4 attributes per Annotation.
        description:
          $ref: '#/components/schemas/TruncatableString'
          description: Optional. A user-supplied message describing the event. The maximum length for the description is 256 bytes.
    MessageEvent:
      properties:
        id:
          type: string
          format: int64
          description: Optional. An identifier for the MessageEvent's message that can be used to match `SENT` and `RECEIVED` MessageEvents.
        type:
          description: Optional. Type of MessageEvent. Indicates whether the message was sent or received.
          type: string
          enum:
          - TYPE_UNSPECIFIED
          - SENT
          - RECEIVED
        uncompressedSizeBytes:
          description: Optional. The number of uncompressed bytes sent or received.
          type: string
          format: int64
        compressedSizeBytes:
          type: string
          format: int64
          description: Optional. The number of compressed bytes sent or received. If missing, the compressed size is assumed to be the same size as the uncompressed size.
      type: object
      description: An event describing a message sent/received between Spans.
    TimeEvent:
      properties:
        annotation:
          $ref: '#/components/schemas/Annotation'
          description: Text annotation with a set of attributes.
        messageEvent:
          $ref: '#/components/schemas/MessageEvent'
          description: An event describing a message sent/received between Spans.
        time:
          format: google-datetime
          description: Optional. The timestamp indicating the time the event occurred.
          type: string
      type: object
      description: A time-stamped annotation or message event in the Span.
    StackFrames:
      properties:
        droppedFramesCount:
          description: Optional. The number of stack frames that were dropped because there were too many stack frames. If this value is 0, then no stack frames were dropped.
          format: int32
          type: integer
        frame:
          description: Optional. Stack frames in this call stack.
          type: array
          items:
            $ref: '#/components/schemas/StackFrame'
      type: object
      description: A collection of stack frames, which can be truncated.
    Empty:
      description: 'A generic empty message that you can re-use to avoid defining duplicated empty messages in your APIs. A typical example is to use it as the request or the response type of an API method. For instance: service Foo { rpc Bar(google.protobuf.Empty) returns (google.protobuf.Empty); }'
      type: object
      properties: {}
    GoogleRpcError:
      type: object
      description: The error envelope every Google API returns.
      properties:
        error:
          type: object
          properties:
            code:
              type: integer
            message:
              type: string
            status:
              type: string
            details:
              type: array
              items:
                type: object
    BatchWriteSpansRequest:
      properties:
        spans:
          items:
            $ref: '#/components/schemas/Span'
          type: array
          description: Required. A list of new spans. The span names must not match existing spans, otherwise the results are undefined.
      type: object
      description: The request message for the `BatchWriteSpans` method.
    StackTrace:
      properties:
        stackFrames:
          $ref: '#/components/schemas/StackFrames'
          description: Optional. Stack frames in this stack trace. A maximum of 128 frames are allowed.
        stackTraceHashId:
          format: int64
          type: string
          description: Optional. The hash ID is used to conserve network bandwidth for duplicate stack traces within a single trace. Often multiple spans will have identical stack traces. The first occurrence of a stack trace should contain both the `stackFrame` content and a value in `stackTraceHashId`. Subsequent spans within the same request can refer to that stack trace by only setting `stackTraceHashId`.
      description: A call stack appearing in a trace.
      type: object
    Module:
      properties:
        buildId:
          $ref: '#/components/schemas/TruncatableString'
          description: Optional. A unique identifier for the module, usually a hash of its contents (up to 128 bytes).
        module:
          $ref: '#/components/schemas/TruncatableString'
          description: 'Optional. For example: main binary, kernel modules, and dynamic libraries such as libc.so, sharedlib.so (up to 256 bytes).'
      description: Binary module.
      type: object
    TruncatableString:
      description: Represents a string that might be shortened to a specified length.
      type: object
      properties:
        truncatedByteCount:
          format: int32
          description: Optional. The number of bytes removed from the original string. If this value is 0, then the string was not shortened.
          type: integer
        value:
          description: Optional. The shortened string. For example, if the original string is 500 bytes long and the limit of the string is 128 bytes, then `value` contains the first 128 bytes of the 500-byte string. Truncation always happens on a UTF8 character boundary. If there are multi-byte characters in the string, then the length of the shortened string might be less than the size limit.
          type: string
    Attributes:
      description: A set of attributes as key-value pairs.
      properties:
        droppedAttributesCount:
          type: integer
          description: Optional. The number of attributes that were discarded. Attributes can be discarded because their keys are too long or because there are too many attributes. If this value is 0 then all attributes are valid.
          format: int32
        attributeMap:
          type: object
          description: 'Optional. A set of attributes. Each attribute''s key can be up to 128 bytes long. The value can be a string up to 256 bytes, a signed 64-bit integer, or the boolean values `true` or `false`. For example: "/instance_id": { "string_value": { "value": "my-instance" } } "/http/request_bytes": { "int_value": 300 } "example.com/myattribute": { "bool_value": false }'
          additionalProperties:
            $ref: '#/components/schemas/AttributeValue'
      type: object
    TimeEvents:
      type: object
      description: A collection of `TimeEvent`s. A `TimeEvent` is a time-stamped annotation on the span, consisting of either user-supplied key:value pairs, or details of a message sent/received between Spans.
      properties:
        droppedMessageEventsCount:
          description: Optional. The number of dropped message events in all the included time events. If the value is 0, then no message events were dropped.
          format: int32
          type: integer
        droppedAnnotationsCount:
          format: int32
          type: integer
          description: Optional. The number of dropped annotations in all the included time events. If the value is 0, then no annotations were dropped.
        timeEvent:
          type: array
          items:
            $ref: '#/components/schemas/TimeEvent'
          description: Optional. A collection of `TimeEvent`s.
    StackFrame:
      type: object
      description: Represents a single stack frame in a stack trace.
      properties:
        fileName:
          $ref: '#/components/schemas/TruncatableString'
          description: Optional. The name of the source file where the function call appears (up to 256 bytes).
        lineNumber:
          format: int64
          type: string
          description: Optional. The line number in `file_name` where the function call appears.
        loadModule:
          $ref: '#/components/schemas/Module'
          description: Optional. The binary module from where the code was loaded.
        functionName:
          $ref: '#/components/schemas/TruncatableString'
          description: Optional. The fully-qualified name that uniquely identifies the function or method that is active in this frame (up to 1024 bytes).
        originalFunctionName:
          $ref: '#/components/schemas/TruncatableString'
          description: Optional. An un-mangled function name, if `function_name` is mangled. To get information about name mangling, run [this search](https://www.google.com/search?q=cxx+name+mangling). The name can be fully-qualified (up to 1024 bytes).
        columnNumber:
          description: Optional. The column number where the function call appears, if available. This is important in JavaScript because of its anonymous functions.
          type: string
          format: int64
        sourceVersion:
          $ref: '#/components/schemas/TruncatableString'
          description: Optional. The version of the deployed source code (up to 128 bytes).
    Links:
      description: A collection of links, which are references from this span to a span in the same or different trace.
      properties:
        link:
          items:
            $ref: '#/components/schemas/Link'
          type: array
          description: Optional. A collection of links.
        droppedLinksCount:
          type: integer
          format: int32
          description: Optional. The number of dropped links after the maximum size was enforced. If this value is 0, then no links were dropped.
      type: object
    AttributeValue:
      description: The allowed types for `[VALUE]` in a `[KEY]:[VALUE]` attribute.
      type: object
      properties:
        intValue:
          description: Optional. A 64-bit signed integer.
          format: int64
          type: string
        stringValue:
          $ref: '#/components/schemas/TruncatableString'
          description: Optional. A string up to 256 bytes long.
        boolValue:
          description: Optional. A Boolean value represented by `true` or `false`.
          type: boolean
    Link:
      type: object
      description: A pointer from the current span to another span in the same trace or in a different trace. For example, this can be used in batching operations, where a single batch handler processes multiple requests from different traces or when the handler receives a request from a different project.
      properties:
        spanId:
          description: Optional. The `[SPAN_ID]` for a span within a trace.
          type: string
        type:
          enum:
          - TYPE_UNSPECIFIED
          - CHILD_LINKED_SPAN
          - PARENT_LINKED_SPAN
          type: string
          description: Optional. The relationship of the current span relative to the linked span.
        attributes:
          $ref: '#/components/schemas/Attributes'
          description: Optional. A set of attributes on the link. Up to 32 attributes can be specified per link.
        traceId:
          type: string
          description: Optional. The `[TRACE_ID]` for a trace within a project.
    Status:
      type: object
      description: 'The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors).'
      properties:
        message:
          type: string
          description: A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the google.rpc.Status.details field, or localized by the client.
        code:
          format: int32
          type: integer
          description: The status code, which should be an enum value of google.rpc.Code.
        details:
          type: array
          description: A list of messages that carry the error details. There is a common set of message types for APIs to use.
          items:
            additionalProperties:
              description: Properties of the object. Contains field @type with type URL.
            type: object
    Span:
      description: A span represents a single operation within a trace. Spans can be nested to form a trace tree. Often, a trace contains a root span that describes the end-to-end latency, and one or more subspans for its sub-operations. A trace can also contain multiple root spans, or none at all. Spans do not need to be contiguous. There might be gaps or overlaps between spans in a trace.
      properties:
        stackTrace:
          $ref: '#/components/schemas/StackTrace'
          description: Optional. Stack trace captured at the start of the span.
        sameProcessAsParentSpan:
          description: Optional. Set this parameter to indicate whether this span is in the same process as its parent. If you do not set this parameter, Trace is unable to take advantage of this helpful information.
          type: boolean
        startTime:
          format: google-datetime
          type: string
          description: Required. The start time of the span. On the client side, this is the time kept by the local machine where the span execution starts. On the server side, this is the time when the server's application handler starts running.
        status:
          $ref: '#/components/schemas/Status'
          description: Optional. The final status for this span.
        spanId:
          type: string
          description: Required. The `[SPAN_ID]` portion of the span's resource name.
        attributes:
          $ref: '#/components/schemas/Attributes'
          description: Optional. A set of attributes on the span. You can have up to 32 attributes per span.
        childSpanCount:
          description: Optional. The number of child spans that were generated while this span was active. If set, allows implementation to detect missing child spans.
          type: integer
          format: int32
        spanKind:
          type: string
          description: Optional. Distinguishes between spans generated in a particular context. For example, two spans with the same name may be distinguished using `CLIENT` (caller) and `SERVER` (callee) to identify an RPC call.
          enum:
          - SPAN_KIND_UNSPECIFIED
          - INTERNAL
          - SERVER
          - CLIENT
          - PRODUCER
          - CONSUMER
        endTime:
          format: google-datetime
          description: Required. The end time of the span. On the client side, this is the time kept by the local machine where the span execution ends. On the server side, this is the time when the server application handler stops running.
          type: string
        name:
          description: 'Identifier. The resource name of the span in the following format: * `projects/[PROJECT_ID]/traces/[TRACE_ID]/spans/[SPAN_ID]` `[TRACE_ID]` is a unique identifier for a trace within a project; it is a 32-character hexadecimal encoding of a 16-byte array. It should not be zero. `[SPAN_ID]` is a unique identifier for a span within a trace; it is a 16-character hexadecimal encoding of an 8-byte array. It should not be zero. .'
          type: string
        parentSpanId:
          type: string
          description: Optional. The `[SPAN_ID]` of this span's parent span. If this is a root span, then this field must be empty.
        timeEvents:
          $ref: '#/components/schemas/TimeEvents'
          description: Optional. A set of time events. You can have up to 32 annotations and 128 message events per span.
        links:
          $ref: '#/components/schemas/Links'
          description: Optional. Links associated with the span. You can have up to 128 links per Span.
        displayName:
          $ref: '#/components/schemas/TruncatableString'
          description: Required. A description of the span's operation (up to 128 bytes). Cloud Trace displays the description in the Cloud console. For example, the display name can be a qualified method name or a file name and a line number where the operation is called. A best practice is to use the same display name within an application and at the same call point. This makes it easier to correlate spans in different traces.
      type: object
  securitySchemes:
    apiKey:
      type: apiKey
      in: query
      name: key
      description: API key; accepted by methods that do not need user data.
    oauth2:
      type: oauth2
      flows:
        authorizationCode:
          authorizationUrl: https://accounts.google.com/o/oauth2/auth
          tokenUrl: https://oauth2.googleapis.com/token
          scopes:
            https://www.googleapis.com/auth/trace.append: Write Trace data for a project or application
            https://www.googleapis.com/auth/cloud-platform: See, edit, configure, and delete your Google Cloud data and see the email address for your Google Account.
externalDocs:
  url: https://cloud.google.com/trace/
x-provenance:
  method: harvested
  publisher: Google
  source: https://cloudtrace.googleapis.com/$discovery/rest?version=v2
  note: converted by discovery-to-openapi.py from Google's Discovery document (revision 20261106)