{
  "openapi": "3.1.0",
  "info": {
    "title": "Meinlup API",
    "summary": "Tenant-scoped access to operational data collected by managed agents.",
    "description": "Use an API key issued by Meinlup. The credential fixes the tenant and scopes; tenant identifiers supplied by consumers are never used for authorization.",
    "version": "0.1.0"
  },
  "servers": [
    {
      "url": "https://api.meinlup.com"
    }
  ],
  "paths": {
    "/v1/calls": {
      "get": {
        "tags": [
          "Calls"
        ],
        "summary": "List calls",
        "operationId": "list_calls_v1_calls_get",
        "security": [
          {
            "MeinlupApiKey": [
              "calls:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "default": 25,
              "title": "Limit"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Cursor"
            }
          },
          {
            "name": "channel",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "phone",
                    "playground"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Channel"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "in_progress",
                    "analysis_pending",
                    "completed",
                    "failed"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_CallSummary_"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/calls/{call_id}": {
      "get": {
        "tags": [
          "Calls"
        ],
        "summary": "Get a call",
        "operationId": "get_call_v1_calls__call_id__get",
        "security": [
          {
            "MeinlupApiKey": [
              "calls:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "call_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Call Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CallDetail"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/workflow-records": {
      "get": {
        "tags": [
          "Workflow records"
        ],
        "summary": "List structured records",
        "operationId": "list_workflow_records_v1_workflow_records_get",
        "security": [
          {
            "MeinlupApiKey": [
              "workflow_records:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "maximum": 100,
              "minimum": 1,
              "default": 25,
              "title": "Limit"
            }
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Cursor"
            }
          },
          {
            "name": "workflow_key",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "type": "string",
                  "minLength": 2,
                  "maxLength": 100,
                  "pattern": "^[a-z][a-z0-9_.-]+$"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Workflow Key"
            }
          },
          {
            "name": "status",
            "in": "query",
            "required": false,
            "schema": {
              "anyOf": [
                {
                  "enum": [
                    "collected",
                    "processing",
                    "completed",
                    "failed",
                    "cancelled"
                  ],
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ],
              "title": "Status"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Page_WorkflowRecord_"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/v1/workflow-records/{record_id}": {
      "get": {
        "tags": [
          "Workflow records"
        ],
        "summary": "Get a structured record",
        "operationId": "get_workflow_record_v1_workflow_records__record_id__get",
        "security": [
          {
            "MeinlupApiKey": [
              "workflow_records:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "record_id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid",
              "title": "Record Id"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WorkflowRecord"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "CallDetail": {
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "title": "Id"
          },
          "agent_id": {
            "type": "string",
            "format": "uuid",
            "title": "Agent Id"
          },
          "client_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "title": "Client Id"
          },
          "channel": {
            "type": "string",
            "title": "Channel"
          },
          "status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status"
          },
          "started_at": {
            "type": "string",
            "format": "date-time",
            "title": "Started At"
          },
          "ended_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ended At"
          },
          "duration_seconds": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Duration Seconds"
          },
          "summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Summary"
          },
          "failure_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Failure Code"
          },
          "analysis_attempts": {
            "type": "integer",
            "title": "Analysis Attempts"
          },
          "analysis_updated_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Analysis Updated At"
          },
          "memory_status": {
            "type": "string",
            "title": "Memory Status"
          },
          "interaction_profile_status": {
            "type": "string",
            "title": "Interaction Profile Status"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "id",
          "agent_id",
          "client_id",
          "channel",
          "status",
          "started_at",
          "ended_at",
          "duration_seconds",
          "summary",
          "failure_code",
          "analysis_attempts",
          "analysis_updated_at",
          "memory_status",
          "interaction_profile_status",
          "created_at"
        ],
        "title": "CallDetail"
      },
      "CallSummary": {
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "title": "Id"
          },
          "agent_id": {
            "type": "string",
            "format": "uuid",
            "title": "Agent Id"
          },
          "client_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "title": "Client Id"
          },
          "channel": {
            "type": "string",
            "title": "Channel"
          },
          "status": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Status"
          },
          "started_at": {
            "type": "string",
            "format": "date-time",
            "title": "Started At"
          },
          "ended_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Ended At"
          },
          "duration_seconds": {
            "anyOf": [
              {
                "type": "integer"
              },
              {
                "type": "null"
              }
            ],
            "title": "Duration Seconds"
          },
          "summary": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Summary"
          },
          "failure_code": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Failure Code"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "id",
          "agent_id",
          "client_id",
          "channel",
          "status",
          "started_at",
          "ended_at",
          "duration_seconds",
          "summary",
          "failure_code"
        ],
        "title": "CallSummary"
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "Page_CallSummary_": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/CallSummary"
            },
            "type": "array",
            "title": "Data"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Cursor"
          },
          "has_more": {
            "type": "boolean",
            "title": "Has More"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "data",
          "next_cursor",
          "has_more"
        ],
        "title": "Page[CallSummary]"
      },
      "Page_WorkflowRecord_": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/WorkflowRecord"
            },
            "type": "array",
            "title": "Data"
          },
          "next_cursor": {
            "anyOf": [
              {
                "type": "string"
              },
              {
                "type": "null"
              }
            ],
            "title": "Next Cursor"
          },
          "has_more": {
            "type": "boolean",
            "title": "Has More"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "data",
          "next_cursor",
          "has_more"
        ],
        "title": "Page[WorkflowRecord]"
      },
      "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"
      },
      "WorkflowRecord": {
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid",
            "title": "Id"
          },
          "call_id": {
            "type": "string",
            "format": "uuid",
            "title": "Call Id"
          },
          "client_id": {
            "anyOf": [
              {
                "type": "string",
                "format": "uuid"
              },
              {
                "type": "null"
              }
            ],
            "title": "Client Id"
          },
          "workflow_key": {
            "type": "string",
            "title": "Workflow Key"
          },
          "schema_version": {
            "type": "integer",
            "title": "Schema Version"
          },
          "status": {
            "type": "string",
            "title": "Status"
          },
          "payload": {
            "additionalProperties": true,
            "type": "object",
            "title": "Payload"
          },
          "created_at": {
            "type": "string",
            "format": "date-time",
            "title": "Created At"
          },
          "updated_at": {
            "type": "string",
            "format": "date-time",
            "title": "Updated At"
          },
          "completed_at": {
            "anyOf": [
              {
                "type": "string",
                "format": "date-time"
              },
              {
                "type": "null"
              }
            ],
            "title": "Completed At"
          }
        },
        "additionalProperties": false,
        "type": "object",
        "required": [
          "id",
          "call_id",
          "client_id",
          "workflow_key",
          "schema_version",
          "status",
          "payload",
          "created_at",
          "updated_at",
          "completed_at"
        ],
        "title": "WorkflowRecord"
      }
    },
    "securitySchemes": {
      "MeinlupApiKey": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    }
  }
}
