> ## Documentation Index
> Fetch the complete documentation index at: https://docs.scorecard.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Record Tag

> Apply a tag to a Record. Idempotent: re-applying an existing tag returns the existing tag.



## OpenAPI

````yaml post /records/{recordId}/tags
openapi: 3.1.0
info:
  title: Scorecard API
  description: REST API for Scorecard
  version: 1.0.0
servers:
  - url: https://api2.scorecard.io/api/v2
security:
  - ApiKeyAuth: []
paths:
  /records/{recordId}/tags:
    post:
      summary: Create Record Tag
      description: >-
        Apply a tag to a Record. Idempotent: re-applying an existing tag returns
        the existing tag.
      operationId: createRecordTag
      parameters:
        - in: path
          name: recordId
          description: The ID of the Record to tag.
          schema:
            type: string
            example: '777'
          required: true
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                text:
                  type: string
                  description: >-
                    The tag text to apply. Idempotent: re-applying an existing
                    tag is a no-op.
              required:
                - text
            examples:
              Tag a record:
                value:
                  text: urgent
                summary: Tag a record
                description: Apply the `urgent` tag to a Record.
      responses:
        '201':
          description: The created (or existing) tag.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/RecordTag'
              examples:
                Created tag:
                  value:
                    id: '1'
                    recordId: '777'
                    text: urgent
                    source: user
                    userId: user_abc123
                    createdAt: '2026-03-01T12:00:00.000Z'
                  summary: Created tag
                  description: Response after successfully tagging a Record.
        '401':
          $ref: '#/components/responses/UnauthenticatedError'
        '500':
          $ref: '#/components/responses/ServiceError'
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Scorecard from 'scorecard-ai';


            const client = new Scorecard({
              apiKey: process.env['SCORECARD_API_KEY'], // This is the default and can be omitted
            });


            const recordTag = await client.records.tags.create('777', { text:
            'urgent' });


            console.log(recordTag.id);
        - lang: Python
          source: |-
            import os
            from scorecard_ai import Scorecard

            client = Scorecard(
                api_key=os.environ.get("SCORECARD_API_KEY"),  # This is the default and can be omitted
            )
            record_tag = client.records.tags.create(
                record_id="777",
                text="urgent",
            )
            print(record_tag.id)
        - lang: cURL
          source: |-
            curl https://api2.scorecard.io/api/v2/records/$RECORD_ID/tags \
                -H 'Content-Type: application/json' \
                -H "Authorization: Bearer $SCORECARD_API_KEY" \
                -d '{
                      "text": "urgent"
                    }'
components:
  schemas:
    RecordTag:
      type: object
      properties:
        id:
          type: string
          description: The ID of the tag.
        recordId:
          type: string
          description: The ID of the Record this tag belongs to.
        text:
          type: string
          description: >-
            The tag text. May encode key:value semantics with a colon (e.g.
            `env:prod`).
        source:
          type: string
          enum:
            - user
            - otel
          description: >-
            How the tag was applied: `user` (UI, SDK, or REST) or `otel` (lifted
            from a span attribute at ingest).
        userId:
          type:
            - string
            - 'null'
          description: The ID of the user who applied the tag; null for OTel-sourced tags.
        createdAt:
          type: string
          description: The ISO 8601 timestamp when the tag was created.
      required:
        - id
        - recordId
        - text
        - source
        - userId
        - createdAt
      description: >-
        An arbitrary tag applied to a Record (e.g. `urgent`, `regression`,
        `env:prod`), either by a user or lifted from OTel span attributes at
        ingest.
    ApiError:
      type: object
      properties:
        code:
          type: string
        message:
          type: string
        details:
          type: object
          additionalProperties: true
          x-stainless-any: true
      required:
        - code
        - message
        - details
      description: An API error.
  responses:
    UnauthenticatedError:
      description: Error indicating that the request is not authenticated.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          examples:
            Authentication failure:
              value:
                code: UNAUTHORIZED
                message: Invalid or missing authentication token
                details: {}
              summary: Authentication failure
              description: >-
                Error returned when authentication credentials are invalid or
                missing.
    ServiceError:
      description: >-
        An internal service error indicating an issue with the Scorecard
        service.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ApiError'
          examples:
            Internal error:
              value:
                code: INTERNAL_ERROR
                message: An unexpected error occurred while processing your request.
                details: {}
              summary: Internal error
              description: Generic error when an unexpected internal issue occurs.
  securitySchemes:
    ApiKeyAuth:
      type: http
      scheme: bearer
      bearerFormat: starts with ak_

````