Capital.com Public API · Capability

Capital.com REST API — Positions

Capital.com REST API — Positions. 6 operations. Lead operation: Get Deal Confirmation. Self-contained Naftiko capability covering one Capital Com Public Api business surface.

Run with Naftiko Capital Com Public ApiPositions

What You Can Do

GET
Getdealconfirmation — Get Deal Confirmation
/v1/api/v1/confirms/{dealreference}
GET
Listpositions — List All Positions
/v1/api/v1/positions
POST
Createposition — Create Position
/v1/api/v1/positions
GET
Getposition — Get Position
/v1/api/v1/positions/{dealid}
PUT
Updateposition — Update Position
/v1/api/v1/positions/{dealid}
DELETE
Closeposition — Close Position
/v1/api/v1/positions/{dealid}

MCP Tools

get-deal-confirmation

Get Deal Confirmation

read-only idempotent
list-all-positions

List All Positions

read-only idempotent
create-position

Create Position

get-position

Get Position

read-only idempotent
update-position

Update Position

idempotent
close-position

Close Position

idempotent

Capability Spec

capital-com-rest-positions.yaml Raw ↑
naftiko: 1.0.0-alpha2
info:
  label: Capital.com REST API — Positions
  description: 'Capital.com REST API — Positions. 6 operations. Lead operation: Get Deal Confirmation. Self-contained Naftiko
    capability covering one Capital Com Public Api business surface.'
  tags:
  - Capital Com Public Api
  - Positions
  created: '2026-05-19'
  modified: '2026-05-19'
binds:
- namespace: env
  keys:
    CAPITAL_COM_PUBLIC_API_API_KEY: CAPITAL_COM_PUBLIC_API_API_KEY
capability:
  consumes:
  - type: http
    namespace: capital-com-rest-positions
    baseUri: https://api-capital.backend-capital.com
    description: Capital.com REST API — Positions business capability. Self-contained, no shared references.
    resources:
    - name: api-v1-confirms-dealReference
      path: /api/v1/confirms/{dealReference}
      operations:
      - name: getdealconfirmation
        method: GET
        description: Get Deal Confirmation
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: dealReference
          in: path
          type: string
          description: The deal reference identifier.
          required: true
    - name: api-v1-positions
      path: /api/v1/positions
      operations:
      - name: listpositions
        method: GET
        description: List All Positions
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
      - name: createposition
        method: POST
        description: Create Position
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
    - name: api-v1-positions-dealId
      path: /api/v1/positions/{dealId}
      operations:
      - name: getposition
        method: GET
        description: Get Position
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: dealId
          in: path
          type: string
          description: The deal ID for the position.
          required: true
      - name: updateposition
        method: PUT
        description: Update Position
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: dealId
          in: path
          type: string
          description: The deal ID for the position.
          required: true
        - name: body
          in: body
          type: object
          description: Request body (JSON).
          required: true
      - name: closeposition
        method: DELETE
        description: Close Position
        outputRawFormat: json
        outputParameters:
        - name: result
          type: object
          value: $.
        inputParameters:
        - name: dealId
          in: path
          type: string
          description: The deal ID for the position to close.
          required: true
    authentication:
      type: apikey
      key: X-CAP-API-KEY
      value: '{{env.CAPITAL_COM_PUBLIC_API_API_KEY}}'
      placement: header
  exposes:
  - type: rest
    namespace: capital-com-rest-positions-rest
    port: 8080
    description: REST adapter for Capital.com REST API — Positions. One Spectral-compliant resource per consumed operation,
      prefixed with /v1.
    resources:
    - path: /v1/api/v1/confirms/{dealreference}
      name: api-v1-confirms-dealreference
      description: REST surface for api-v1-confirms-dealReference.
      operations:
      - method: GET
        name: getdealconfirmation
        description: Get Deal Confirmation
        call: capital-com-rest-positions.getdealconfirmation
        with:
          dealReference: rest.dealReference
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/v1/positions
      name: api-v1-positions
      description: REST surface for api-v1-positions.
      operations:
      - method: GET
        name: listpositions
        description: List All Positions
        call: capital-com-rest-positions.listpositions
        outputParameters:
        - type: object
          mapping: $.
      - method: POST
        name: createposition
        description: Create Position
        call: capital-com-rest-positions.createposition
        with:
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
    - path: /v1/api/v1/positions/{dealid}
      name: api-v1-positions-dealid
      description: REST surface for api-v1-positions-dealId.
      operations:
      - method: GET
        name: getposition
        description: Get Position
        call: capital-com-rest-positions.getposition
        with:
          dealId: rest.dealId
        outputParameters:
        - type: object
          mapping: $.
      - method: PUT
        name: updateposition
        description: Update Position
        call: capital-com-rest-positions.updateposition
        with:
          dealId: rest.dealId
          body: rest.body
        outputParameters:
        - type: object
          mapping: $.
      - method: DELETE
        name: closeposition
        description: Close Position
        call: capital-com-rest-positions.closeposition
        with:
          dealId: rest.dealId
        outputParameters:
        - type: object
          mapping: $.
  - type: mcp
    namespace: capital-com-rest-positions-mcp
    port: 9090
    transport: http
    description: MCP adapter for Capital.com REST API — Positions. One tool per consumed operation, routed inline through
      this capability's consumes block.
    tools:
    - name: get-deal-confirmation
      description: Get Deal Confirmation
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: capital-com-rest-positions.getdealconfirmation
      with:
        dealReference: tools.dealReference
      outputParameters:
      - type: object
        mapping: $.
    - name: list-all-positions
      description: List All Positions
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: capital-com-rest-positions.listpositions
      outputParameters:
      - type: object
        mapping: $.
    - name: create-position
      description: Create Position
      hints:
        readOnly: false
        destructive: false
        idempotent: false
      call: capital-com-rest-positions.createposition
      with:
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: get-position
      description: Get Position
      hints:
        readOnly: true
        destructive: false
        idempotent: true
      call: capital-com-rest-positions.getposition
      with:
        dealId: tools.dealId
      outputParameters:
      - type: object
        mapping: $.
    - name: update-position
      description: Update Position
      hints:
        readOnly: false
        destructive: false
        idempotent: true
      call: capital-com-rest-positions.updateposition
      with:
        dealId: tools.dealId
        body: tools.body
      outputParameters:
      - type: object
        mapping: $.
    - name: close-position
      description: Close Position
      hints:
        readOnly: false
        destructive: true
        idempotent: true
      call: capital-com-rest-positions.closeposition
      with:
        dealId: tools.dealId
      outputParameters:
      - type: object
        mapping: $.