FOREX.com Session API

Authentication and session management

OpenAPI Specification

forex-com-session-api-openapi.yml Raw ↑
openapi: 3.0.3
info:
  title: FOREX.com REST Account Session API
  description: The FOREX.com REST API, hosted at ciapi.cityindex.com/TradingAPI, enables algorithmic traders to authenticate sessions, retrieve real-time and historical price data, execute buy/sell orders across 80+ forex and CFD markets, and manage account balances, positions, and order history programmatically. Authentication uses a session-based header credential obtained from the /session endpoint. A separate FIX API is available for institutional clients.
  version: 1.0.0
  contact:
    name: FOREX.com API Support
    url: https://www.forex.com/en/help-and-support/
    email: support.en@forex.com
  termsOfService: https://www.forex.com/en-us/help-and-support/pricing-and-fees/
  x-api-id: forex-com-trading-api
  x-logo:
    url: https://www.forex.com/favicon.ico
servers:
- url: https://ciapi.cityindex.com/TradingAPI
  description: FOREX.com REST API Base URL
security:
- SessionAuth: []
  UserNameAuth: []
tags:
- name: Session
  description: Authentication and session management
paths:
  /session:
    post:
      operationId: createSession
      summary: Create a session (authenticate)
      description: Authenticate with FOREX.com using username, password, and AppKey. Returns a Session ID used as a header credential for all subsequent requests. The AppKey must be obtained by contacting support.en@forex.com (allow up to 3 business days for activation).
      tags:
      - Session
      security: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/SessionRequest'
            example:
              UserName: myusername
              Password: mypassword
              AppKey: my-app-key
              AppVersion: '1'
              AppComments: ''
      responses:
        '200':
          description: Session created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SessionResponse'
              example:
                Session: abc123-session-id-xyz
                StatusCode: 1
components:
  schemas:
    SessionRequest:
      type: object
      required:
      - UserName
      - Password
      - AppKey
      properties:
        UserName:
          type: string
          description: FOREX.com account username
        Password:
          type: string
          description: FOREX.com account password
          format: password
        AppKey:
          type: string
          description: Application key obtained from FOREX.com support
        AppVersion:
          type: string
          description: Application version identifier
          default: '1'
        AppComments:
          type: string
          description: Optional application comments
          default: ''
    SessionResponse:
      type: object
      properties:
        Session:
          type: string
          description: Session ID to use as header credential for subsequent requests
        StatusCode:
          type: integer
          description: Status code (1 = success)
  securitySchemes:
    SessionAuth:
      type: apiKey
      in: header
      name: Session
      description: Session ID obtained from POST /session
    UserNameAuth:
      type: apiKey
      in: header
      name: UserName
      description: FOREX.com account username
externalDocs:
  description: FOREX.com API Trading Documentation
  url: https://www.forex.com/en/trading-tools/api-trading/