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

# Add Tag To Entity

> Create a new tag attached to the object specified inside the tag body.
A tag is a key-value pair that can be attached to specific objects, currently vehicles or batteries.
This can be used to categorize those objects and link them back to objects in your system.

For example, if you wanted to add a fleet id to a vehicle, you could pass a tag
with key "fleet_id" and then the id value, set the entityType to "DEVICE",
and pass, as the entityId, the ID of the vehicle you want to tag.

This would tag that vehicle with the fleet_id "1234", and you could query in the list vehicles endpoint for
vehicles with that tag.

The entity types that can be currently passed are:
- `DEVICE`

**Returns:**
- A response with an empty body and a 200 status code


Possible Codes in Error Response (see [Errors](https://docs.volteras.com/api-reference/errors) for error response schema and meaning of codes):

- AUTHENTICATION_ERROR
- REQUEST_VALIDATION_ERROR
- RESOURCE_NOT_FOUND
- SERVER_ERROR



## OpenAPI

````yaml post /v1/tags
openapi: 3.1.0
info:
  title: VOLTERAS CONNECT
  version: 0.1.0
servers:
  - url: https://api.volteras.com
  - url: https://api.sandbox.volteras.com
security: []
paths:
  /v1/tags:
    post:
      tags:
        - Tags
      summary: Add Tag To Entity
      description: >-
        Create a new tag attached to the object specified inside the tag body.

        A tag is a key-value pair that can be attached to specific objects,
        currently vehicles or batteries.

        This can be used to categorize those objects and link them back to
        objects in your system.


        For example, if you wanted to add a fleet id to a vehicle, you could
        pass a tag

        with key "fleet_id" and then the id value, set the entityType to
        "DEVICE",

        and pass, as the entityId, the ID of the vehicle you want to tag.


        This would tag that vehicle with the fleet_id "1234", and you could
        query in the list vehicles endpoint for

        vehicles with that tag.


        The entity types that can be currently passed are:

        - `DEVICE`


        **Returns:**

        - A response with an empty body and a 200 status code



        Possible Codes in Error Response (see
        [Errors](https://docs.volteras.com/api-reference/errors) for error
        response schema and meaning of codes):


        - AUTHENTICATION_ERROR

        - REQUEST_VALIDATION_ERROR

        - RESOURCE_NOT_FOUND

        - SERVER_ERROR
      operationId: add_tag_to_entity_v1_tags_post
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublicTagCreate'
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
      security:
        - OAuth2ClientCredentialsBearer: []
components:
  schemas:
    PublicTagCreate:
      properties:
        key:
          type: string
          maxLength: 150
          title: Key
        value:
          type: string
          maxLength: 150
          title: Value
        objectType:
          $ref: '#/components/schemas/PublicTagEntityTypes'
          description: >-
            What type of object is being tagged, such as 'VEHICLE'. *IMPORTANT*:
            If the account is tagged, all devices underneath the account will
            also be tagged.
        objectId:
          type: string
          title: Objectid
          description: ID of the object being tagged
      type: object
      required:
        - key
        - value
        - objectType
        - objectId
      title: PublicTagCreate
    PublicTagEntityTypes:
      type: string
      enum:
        - DEVICE
      title: PublicTagEntityTypes
  securitySchemes:
    OAuth2ClientCredentialsBearer:
      type: oauth2
      flows:
        clientCredentials:
          scopes: {}
          tokenUrl: /v1/oauth2/token

````