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

# Acquire Lock

> Acquire an advisory lock on a resource.

Advisory locks signal intent and do not block operations.
If another agent already holds the lock, returns 409 Conflict.
Agents working on the resource without a lock are notified.

Returns:
    Lock entry with acquisition timestamp.



## OpenAPI

````yaml https://api.pragmatiks.io/openapi.json post /presence/locks/{resource_id}
openapi: 3.1.0
info:
  title: Pragma API
  version: 0.1.0
servers: []
security: []
paths:
  /presence/locks/{resource_id}:
    post:
      tags:
        - presence
        - presence
      summary: Acquire Lock
      description: |-
        Acquire an advisory lock on a resource.

        Advisory locks signal intent and do not block operations.
        If another agent already holds the lock, returns 409 Conflict.
        Agents working on the resource without a lock are notified.

        Returns:
            Lock entry with acquisition timestamp.
      operationId: presence-acquire_lock
      parameters:
        - name: resource_id
          in: path
          required: true
          schema:
            type: string
            title: Resource Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/LockAcquireRequest'
      responses:
        '201':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LockEntry'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    LockAcquireRequest:
      properties:
        agent_id:
          type: string
          title: Agent Id
      type: object
      required:
        - agent_id
      title: LockAcquireRequest
      description: |-
        Request body for acquiring an advisory lock.

        Attributes:
            agent_id: ID of the agent requesting the lock.
    LockEntry:
      properties:
        resource_id:
          type: string
          title: Resource Id
        agent_id:
          type: string
          title: Agent Id
        organization_id:
          type: string
          title: Organization Id
        acquired_at:
          type: string
          format: date-time
          title: Acquired At
      type: object
      required:
        - resource_id
        - agent_id
        - organization_id
      title: LockEntry
      description: |-
        Advisory lock on a resource.

        Attributes:
            resource_id: ID of the locked resource.
            agent_id: ID of the agent holding the lock.
            organization_id: Organization the lock belongs to.
            acquired_at: Timestamp when the lock was acquired.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````