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

# Lock doors

> Locks all vehicle doors



## OpenAPI

````yaml /specs/vehicle.yml post /vehicles/{vehicleId}/commands/security/lock
openapi: 3.0.3
info:
  title: Smartcar Vehicle API
  version: 3.0.0
  description: API for vehicle data (signals) and operations (commands).
servers:
  - url: https://vehicle.api.smartcar.com/v3
security: []
tags:
  - name: Charging
    description: Commands for controlling vehicle charging behavior.
  - name: Security
    description: Commands for controlling vehicle door locks.
  - name: Navigation
    description: Commands for setting destinations in the vehicle navigation system.
  - name: Command Executions
    description: Retrieve the recorded result of a previously issued vehicle command.
  - name: Charge Schedules
    description: Create, retrieve, and delete recurring charge schedules on a vehicle.
  - name: Schedule Executions
    description: >-
      Retrieve the recorded result of a previously issued schedule create or
      delete request.
paths:
  /vehicles/{vehicleId}/commands/security/lock:
    post:
      tags:
        - Security
      summary: Lock doors
      description: Locks all vehicle doors
      operationId: lockDoors
      parameters:
        - in: path
          name: vehicleId
          description: The unique identifier for the vehicle.
          schema:
            type: string
          example: v_123abc456def
          required: true
        - in: header
          name: sc-user-id
          required: true
          description: >
            The identifier of the vehicle user on whose behalf the command is
            being executed.

            Vehicle commands require both the `vehicleId` (path) and
            `sc-user-id` (header) to

            identify the specific vehicle and the user who has granted
            permission to act on it.

            The bearer token is a machine-to-machine token and does not carry
            per-user context,

            so this header must be provided explicitly for every command
            request.
          schema:
            type: string
          example: user_789xyz
      responses:
        '200':
          description: 200 OK - Command executed synchronously and successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandResponse'
              example:
                data:
                  id: exec_9876543210
                  type: command-execution
                  attributes:
                    commandType: security-lock
                    status:
                      value: SUCCESS
                    executionMode: sync
                  meta:
                    executedAt: '2024-01-01T12:00:00Z'
                    completedAt: '2024-01-01T12:00:02Z'
                    durationInSeconds: 2
        '202':
          description: >
            202 Accepted — A 202 was sent to keep the connection alive; the body
            contains the final command result.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CommandResponse'
              examples:
                success:
                  summary: Lock doors completed successfully
                  value:
                    data:
                      id: exec_9876543210
                      type: command-execution
                      attributes:
                        commandType: security-lock
                        status:
                          value: SUCCESS
                        executionMode: sync
                      meta:
                        executedAt: '2024-01-01T12:00:00Z'
                        completedAt: '2024-01-01T12:03:10Z'
                        durationInSeconds: 190
                failure:
                  summary: Lock doors failed
                  value:
                    data:
                      id: exec_9876543210
                      type: command-execution
                      attributes:
                        commandType: security-lock
                        status:
                          value: FAILURE
                          error:
                            status: '500'
                            type: VEHICLE
                            code: LOCK_FAILED
                            title: Lock Failed
                            detail: The vehicle was unable to lock its doors.
                            links:
                              about: >-
                                https://smartcar.com/docs/errors/api-errors/v3/lock-failed
                        executionMode: sync
                      meta:
                        executedAt: '2024-01-01T12:00:00Z'
                        completedAt: '2024-01-01T12:03:10Z'
                        durationInSeconds: 190
        '400':
          $ref: '#/components/responses/BadRequest2'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '404':
          $ref: '#/components/responses/NotFound2'
        '409':
          $ref: '#/components/responses/Conflict'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '430':
          $ref: '#/components/responses/BillingError'
        '500':
          $ref: '#/components/responses/InternalError'
        '501':
          $ref: '#/components/responses/NotImplemented'
        '502':
          $ref: '#/components/responses/BadGateway'
        '504':
          $ref: '#/components/responses/GatewayTimeout'
      security:
        - bearerAuth: []
components:
  schemas:
    CommandResponse:
      type: object
      description: Response for a command execution.
      required:
        - data
      properties:
        data:
          type: object
          required:
            - id
            - type
            - attributes
            - meta
          properties:
            id:
              type: string
              description: The unique identifier for this command execution
              example: exec_9876543210
            type:
              type: string
              enum:
                - command-execution
              description: Resource type, always "command-execution".
            attributes:
              $ref: '#/components/schemas/CommandAttributes'
            meta:
              $ref: '#/components/schemas/ExecutionMeta'
      example:
        data:
          id: exec_9876543210
          type: command-execution
          attributes:
            commandType: charge-start
            status:
              value: SUCCESS
            executionMode: sync
          meta:
            executedAt: '2024-01-01T12:00:00Z'
            completedAt: '2024-01-01T12:00:02Z'
            durationInSeconds: 2
    CommandAttributes:
      type: object
      required:
        - commandType
        - status
        - executionMode
      properties:
        commandType:
          $ref: '#/components/schemas/CommandType'
          description: The type of command that was executed.
        status:
          $ref: '#/components/schemas/ExecutionStatus'
        executionMode:
          type: string
          enum:
            - sync
            - async
          readOnly: true
          description: >-
            Whether the command was executed synchronously or asynchronously.
            Reported in the response only — callers cannot specify this.
        parameters:
          description: >-
            The parameters submitted with the command. Present only for
            `charge-set-limit` and `navigation-set-destination`.
          oneOf:
            - $ref: '#/components/schemas/ChargeLimitParameters'
            - $ref: '#/components/schemas/NavigationParameters'
    ExecutionMeta:
      type: object
      required:
        - executedAt
        - completedAt
        - durationInSeconds
      properties:
        executedAt:
          type: string
          format: date-time
          description: ISO 8601 UTC timestamp when execution started.
        completedAt:
          type: string
          format: date-time
          description: ISO 8601 UTC timestamp when execution completed.
        durationInSeconds:
          type: integer
          description: Elapsed time from execution start to completion, in seconds.
      example:
        executedAt: '2024-01-01T12:00:00Z'
        completedAt: '2024-01-01T12:00:02Z'
        durationInSeconds: 2
    ErrorResponse:
      type: object
      required:
        - errors
      properties:
        errors:
          type: array
          minItems: 1
          items:
            type: object
            required:
              - status
              - type
              - code
              - title
              - detail
            properties:
              status:
                type: string
              type:
                type: string
                enum:
                  - AUTHENTICATION
                  - BILLING
                  - COMPATIBILITY
                  - CONNECTED_SERVICES_ACCOUNT
                  - RATE_LIMIT
                  - RESOURCE_NOT_FOUND
                  - SERVER
                  - UPSTREAM
                  - VALIDATION
                  - VEHICLE_STATE
              code:
                type: string
              title:
                type: string
              detail:
                type: string
              resolution:
                type: object
                description: >-
                  Optional field providing guidance on how to resolve the error,
                  if applicable. The structure of this object can vary based on
                  the error type and is intended to provide actionable
                  information to clients.
                properties:
                  type:
                    type: string
                    description: >-
                      The type of resolution recommended (e.g., "RETRY_LATER",
                      "CONTACT_SUPPORT", etc.)
              suggestedUserMessage:
                type: string
                description: >-
                  Optional field providing a user-friendly message that can be
                  displayed to end-users, if applicable. This message is
                  intended to be easily understandable and actionable for users
                  who encounter the error.
              links:
                type: object
                properties:
                  about:
                    type: string
                    format: uri
              meta:
                type: object
                properties:
                  debug:
                    type: object
                    description: >-
                      Debug information for internal use, not intended for
                      clients
                    properties:
                      applicationId:
                        type: string
                        description: The unique identifier for the application
                      requestId:
                        type: string
                        description: The unique identifier for the request
                      origin:
                        type: string
                        description: The origin of the error
                    example:
                      applicationId: app_123abc
                      requestId: req_456def
                      origin: internal.com/path
    CommandType:
      type: string
      description: Command type.
      enum:
        - charge-start
        - charge-stop
        - charge-set-limit
        - security-lock
        - security-unlock
        - navigation-set-destination
    ExecutionStatus:
      type: object
      required:
        - value
      properties:
        value:
          type: string
          description: The state of the command execution
          enum:
            - SUCCESS
            - FAILURE
            - PENDING
        error:
          $ref: '#/components/schemas/ExecutionError'
      example:
        value: SUCCESS
    ChargeLimitParameters:
      description: The parameters submitted with the command, returned in the response.
      allOf:
        - $ref: '#/components/schemas/ChargeLimitAttributes'
      example:
        percent: 80
    NavigationParameters:
      description: The parameters submitted with the command, returned in the response.
      allOf:
        - $ref: '#/components/schemas/NavigationPoint'
      example:
        latitude: 37.7749
        longitude: -122.4194
    ExecutionError:
      type: object
      description: Error details present when `status.value` is `FAILURE`.
      required:
        - status
        - type
        - code
      properties:
        status:
          type: string
        type:
          type: string
        code:
          type: string
        title:
          type: string
        detail:
          type: string
        links:
          type: object
          properties:
            about:
              type: string
              format: uri
        resolution:
          type: object
          description: Guidance on resolving the error. Structure varies by error type.
        suggestedUserMessage:
          type: string
          description: A user-facing message that can be displayed directly to end users.
    ChargeLimitAttributes:
      type: object
      required:
        - percent
      properties:
        percent:
          type: integer
          minimum: 50
          maximum: 100
          description: The desired charge limit percentage (50-100)
      example:
        percent: 80
    NavigationPoint:
      type: object
      description: Geographic pointPoi
      required:
        - latitude
        - longitude
      properties:
        latitude:
          type: number
          format: double
          minimum: -90
          maximum: 90
          description: The latitude coordinate of the location point (-90 to 90)
        longitude:
          type: number
          format: double
          minimum: -180
          maximum: 180
          description: The longitude coordinate of the location point (-180 to 180)
      example:
        latitude: 37.7749
        longitude: -122.4194
  responses:
    BadRequest2:
      description: 400 Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            errors:
              - status: '400'
                type: VALIDATION
                code: BAD_REQUEST
                title: Bad Request
                detail: >-
                  The request could not be understood by the server due to
                  malformed syntax.
                links:
                  about: >-
                    https://smartcar.com/docs/errors/api-errors/v3/validation-errors
    Unauthorized:
      description: 401 Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            errors:
              - status: '401'
                type: AUTHENTICATION
                code: UNAUTHORIZED
                title: Unauthorized
                detail: The Authorization token is missing or invalid.
                links:
                  about: >-
                    https://smartcar.com/docs/errors/api-errors/v3/authentication-errors#authentication
    Forbidden:
      description: 403 Forbidden
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            errors:
              - status: '403'
                type: AUTHENTICATION
                code: FORBIDDEN
                title: Forbidden
                detail: You do not have permission to access this resource.
                links:
                  about: >-
                    https://smartcar.com/docs/errors/api-errors/v3/authentication-errors
    NotFound2:
      description: 404 Not Found
      content:
        application/json:
          schema:
            type: object
            required:
              - errors
            properties:
              errors:
                type: array
                minItems: 1
                items:
                  type: object
                  required:
                    - status
                    - type
                    - code
                    - title
                    - detail
                  properties:
                    status:
                      type: string
                    type:
                      type: string
                      enum:
                        - AUTHENTICATION
                        - BILLING
                        - COMPATIBILITY
                        - CONNECTED_SERVICES_ACCOUNT
                        - RATE_LIMIT
                        - RESOURCE_NOT_FOUND
                        - SERVER
                        - UPSTREAM
                        - VALIDATION
                        - VEHICLE_STATE
                    code:
                      type: string
                    title:
                      type: string
                    detail:
                      type: string
                    resolution:
                      type: object
                      description: >-
                        Optional field providing guidance on how to resolve the
                        error, if applicable. The structure of this object can
                        vary based on the error type and is intended to provide
                        actionable information to clients.
                      properties:
                        type:
                          type: string
                          description: >-
                            The type of resolution recommended (e.g.,
                            "RETRY_LATER", "CONTACT_SUPPORT", etc.)
                    suggestedUserMessage:
                      type: string
                      description: >-
                        Optional field providing a user-friendly message that
                        can be displayed to end-users, if applicable. This
                        message is intended to be easily understandable and
                        actionable for users who encounter the error.
                    links:
                      type: object
                      properties:
                        about:
                          type: string
                          format: uri
                    meta:
                      type: object
                      properties:
                        debug:
                          type: object
                          description: >-
                            Debug information for internal use, not intended for
                            clients
                          properties:
                            applicationId:
                              type: string
                              description: The unique identifier for the application
                            requestId:
                              type: string
                              description: The unique identifier for the request
                            origin:
                              type: string
                              description: The origin of the error
                          example:
                            applicationId: app_123abc
                            requestId: req_456def
                            origin: internal.com/path
          example:
            errors:
              - status: '404'
                type: RESOURCE_NOT_FOUND
                code: NOT_FOUND
                title: Not Found
                detail: The requested resource could not be found.
                links:
                  about: >-
                    https://smartcar.com/docs/errors/api-errors/v3/resource-not-found-errors
    Conflict:
      description: 409 Conflict
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            errors:
              - status: '409'
                type: VEHICLE_STATE
                code: ASLEEP
                title: Vehicle Asleep
                detail: >-
                  The vehicle is in a sleep state and temporarily unable to
                  perform your request.
                links:
                  about: >-
                    https://smartcar.com/docs/errors/api-errors/v3/vehicle-state-errors#asleep
    TooManyRequests:
      description: 429 Too Many Requests
      headers:
        retry-after:
          description: Number of seconds to wait before retrying the request.
          schema:
            type: integer
          example: 60
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            errors:
              - status: '429'
                type: RATE_LIMIT
                code: SMARTCAR_API
                title: Too Many Requests
                detail: >-
                  You have reached the throttling rate limit for this vehicle.
                  Please see the retry-after header for when to retry the
                  request.
                links:
                  about: >-
                    https://smartcar.com/docs/errors/api-errors/v3/rate-limit-errors
    BillingError:
      description: 430 Billing Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            errors:
              - status: '430'
                type: BILLING
                code: VEHICLE_LIMIT
                title: Vehicle Limit Reached
                detail: >-
                  You've reached the limit of vehicles in your plan. Please
                  upgrade to unlock access to more vehicles.
                links:
                  about: >-
                    https://smartcar.com/docs/errors/api-errors/v3/billing-errors#vehicle-limit
                resolution:
                  type: CONTACT_SUPPORT
    InternalError:
      description: 500 Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            errors:
              - status: '500'
                type: SERVER
                code: INTERNAL
                title: Internal Server Error
                detail: An unexpected error occurred on the server.
                links:
                  about: https://smartcar.com/docs/errors/api-errors/v3/server-errors
    NotImplemented:
      description: 501 Not Implemented
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            errors:
              - status: '501'
                type: COMPATIBILITY
                code: MAKE_NOT_COMPATIBLE
                title: Make Not Compatible
                detail: >-
                  Smartcar is not yet compatible with this vehicle's make in the
                  country you specified.
                links:
                  about: >-
                    https://smartcar.com/docs/errors/api-errors/v3/compatibility-errors#make-not-compatible
                resolution:
                  type: null
    BadGateway:
      description: 502 Bad Gateway
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            errors:
              - status: '502'
                type: UPSTREAM
                code: INVALID_DATA
                title: Bad Gateway
                detail: >-
                  Smartcar received invalid data from an upstream source. Please
                  retry your request at a later time.
                links:
                  about: >-
                    https://smartcar.com/docs/errors/api-errors/v3/upstream-errors#invalid-data
                resolution:
                  type: RETRY_LATER
                suggestedUserMessage: >-
                  Your car is temporarily unable to connect to <app name>.
                  Please be patient while we're working to resolve this issue.
    GatewayTimeout:
      description: 504 Gateway Timeout
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
          example:
            errors:
              - status: '504'
                type: SERVER
                code: GATEWAY_TIMEOUT
                title: Gateway Timeout
                detail: The request timed out while waiting for the server to respond.
                links:
                  about: https://smartcar.com/docs/errors/api-errors/v3/server-errors
                resolution:
                  type: RETRY_LATER
                suggestedUserMessage: >-
                  Your car is temporarily unable to connect to <app name>.
                  Please be patient while we're working to resolve this issue.
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT or opaque
      description: |
        The Authorization header must be provided with a valid bearer token.
        Example: `Authorization: Bearer {token}`

````