{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/alpaca/json-schema/alpaca-journal-schema.json",
  "title": "Journal",
  "description": "Represents a cash or security transfer between accounts, as specified by the `entry_type` parameter.",
  "x-generated": "2026-11-05",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/alpaca-journals-api-openapi.yml#/components/schemas/Journal",
  "allOf": [
    {
      "type": "object",
      "properties": {
        "id": {
          "type": "string",
          "format": "uuid",
          "description": "journal ID"
        },
        "entry_type": {
          "$ref": "#/$defs/JournalEntryType"
        },
        "from_account": {
          "type": "string",
          "format": "uuid",
          "description": "account ID the shares go from"
        },
        "to_account": {
          "type": "string",
          "format": "uuid",
          "description": "account ID the shares go to"
        },
        "settle_date": {
          "type": "string",
          "format": "date"
        },
        "status": {
          "$ref": "#/$defs/JournalStatus"
        }
      },
      "required": [
        "id",
        "entry_type",
        "from_account",
        "to_account",
        "settle_date"
      ]
    },
    {
      "oneOf": [
        {
          "$ref": "#/$defs/JNLS"
        },
        {
          "$ref": "#/$defs/JNLC"
        }
      ]
    }
  ],
  "$defs": {
    "JNLC": {
      "description": "Journal information specific to cash transfers. This field is required for `Journal`s with an `entry_type` of `jnlc` (cash transfers), but will be null for those with `jnls` (securities transfers).",
      "type": "object",
      "title": "JNLC",
      "properties": {
        "description": {
          "type": "string",
          "description": "ID the amount goes to. Only valid for JNLC journals. Null for JNLS."
        },
        "net_amount": {
          "type": "string",
          "format": "decimal",
          "description": "Only valid for JNLC journals. Null for JNLS."
        },
        "transmitter_name": {
          "type": "string",
          "description": "Only valid for JNLC journals. Null for JNLS. Max 255 characters."
        },
        "transmitter_account_number": {
          "type": "string",
          "description": "Only valid for JNLC journals. Null for JNLS.max 255 characters"
        },
        "transmitter_address": {
          "type": "string",
          "description": "Only valid for JNLC journals. Null for JNLS.max 255 characters"
        },
        "transmitter_financial_institution": {
          "type": "string",
          "description": "Only valid for JNLC journals. Null for JNLS.max 255 characters"
        },
        "transmitter_timestamp": {
          "type": "string",
          "format": "date-time",
          "description": "Only valid for JNLC journals. Null for JNLS."
        }
      },
      "required": [
        "net_amount"
      ]
    },
    "JNLS": {
      "title": "JNLS",
      "type": "object",
      "description": "Journal information specific to securities transfers. This field is required for `Journal`s with an `entry_type` of `jnls` (securities transfers), but will be null for those with `jnlc` (cash transfers).",
      "properties": {
        "symbol": {
          "type": "string",
          "description": "Only valid for JNLS journals. Null for JNLC."
        },
        "qty": {
          "type": "string",
          "format": "decimal",
          "description": "Only valid for JNLS journals. Null for JNLC."
        },
        "price": {
          "type": "string",
          "format": "decimal",
          "description": "Only valid for JNLS journals. Null for JNLC."
        }
      },
      "required": [
        "symbol",
        "qty",
        "price"
      ]
    },
    "JournalEntryType": {
      "type": "string",
      "title": "",
      "description": "This enum represents the various kinds of Journal alpaca supports.\n\nCurrent values are:\n\n- **JNLC**\n\n  Journal Cash between accounts\n\n- **JNLS**\n\n  Journal Securities between accounts",
      "enum": [
        "JNLC",
        "JNLS"
      ]
    },
    "JournalStatus": {
      "type": "string",
      "enum": [
        "pending",
        "canceled",
        "executed",
        "queued",
        "rejected",
        "deleted"
      ],
      "description": "Represents the status that a Journal instance can be in.\n\nCurrent Values:\n  - pending\n  - canceled\n  - executed\n  - queued\n  - rejected\n  - deleted"
    }
  }
}