{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/currents-dev/json-schema/currents-dev-create-session-request-schema.json",
  "title": "CreateSessionRequest",
  "x-generated": "2026-11-04",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/currents-dev-openapi.yml#/components/schemas/CreateSessionRequest",
  "type": "object",
  "required": [
    "projectId",
    "title",
    "status"
  ],
  "additionalProperties": false,
  "properties": {
    "projectId": {
      "type": "string"
    },
    "title": {
      "type": "string",
      "minLength": 1,
      "maxLength": 1024,
      "description": "What the session set out to show"
    },
    "status": {
      "type": "string",
      "enum": [
        "passed",
        "failed"
      ]
    },
    "error": {
      "type": "string",
      "maxLength": 10000,
      "description": "For a failed session"
    },
    "durationMs": {
      "type": "integer",
      "minimum": 0,
      "maximum": 86400000
    },
    "tags": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 255
      },
      "maxItems": 20
    },
    "commit": {
      "type": "object",
      "properties": {
        "sha": {
          "type": "string"
        },
        "branch": {
          "type": "string"
        },
        "message": {
          "type": "string"
        },
        "authorName": {
          "type": "string"
        },
        "authorEmail": {
          "type": "string"
        },
        "remoteOrigin": {
          "type": "string"
        }
      }
    },
    "pr": {
      "type": "object",
      "description": "The pull request, by `link` or `id`",
      "properties": {
        "link": {
          "type": "string"
        },
        "id": {
          "type": "string"
        }
      }
    },
    "ci": {
      "type": "object",
      "description": "CI variables the pull request is read from when `pr` is not sent",
      "properties": {
        "provider": {
          "type": "string"
        },
        "buildNumber": {
          "type": "string"
        },
        "params": {
          "type": "object"
        }
      }
    },
    "attachments": {
      "type": "array",
      "maxItems": 50,
      "description": "Like an attachment request, but `sizeBytes` is optional. Without it the upload URL does not pin the size or type.",
      "items": {
        "type": "object",
        "required": [
          "name",
          "type",
          "contentType"
        ],
        "properties": {
          "name": {
            "type": "string",
            "minLength": 1,
            "maxLength": 1024
          },
          "type": {
            "type": "string",
            "enum": [
              "trace",
              "screenshot",
              "video",
              "attachment"
            ],
            "description": "Allowed per level: attachment on a run, spec file and test; screenshot, video and attachment on a spec file; trace, screenshot, video and attachment on an attempt."
          },
          "contentType": {
            "type": "string",
            "description": "A trace is application/zip, a screenshot is image/png, image/jpeg, image/webp or image/gif, a video is video/*."
          },
          "sizeBytes": {
            "type": "integer",
            "minimum": 1,
            "maximum": 1073741824,
            "description": "Signed into the upload URL, so storage refuses another size. Organizations that store files in their own S3 bucket behind CloudFront get an upload URL without this check."
          },
          "caption": {
            "type": "string",
            "maxLength": 1000
          },
          "meta": {
            "type": "object",
            "additionalProperties": {
              "type": "string",
              "maxLength": 256
            },
            "description": "At most 20 keys of letters, digits, \"_\" and \"-\", and 2 KB in total."
          }
        }
      }
    }
  }
}