openapi: 3.1.0 info: title: Arthur Scope Agents V1 Custom Aggregations V1 API version: 0.1.0 tags: - name: Custom Aggregations V1 paths: /api/v1/workspaces/{workspace_id}/custom_aggregations: post: tags: - Custom Aggregations V1 summary: Post Custom Aggregation. description: Requires workspace_create_custom_aggregation permission. operationId: post_custom_aggregation security: - OAuth2AuthorizationCode: - workspace_create_custom_aggregation parameters: - name: workspace_id in: path required: true schema: type: string format: uuid title: Workspace Id requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PostCustomAggregationSpecSchema' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/CustomAggregationSpecSchema' '500': content: application/json: schema: $ref: '#/components/schemas/InternalServerError' description: Internal Server Error '400': content: application/json: schema: $ref: '#/components/schemas/BadRequestError' description: Bad Request '404': content: application/json: schema: $ref: '#/components/schemas/NotFoundError' description: Not Found '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' get: tags: - Custom Aggregations V1 summary: Get Custom Aggregation. description: Requires workspace_list_custom_aggregations permission. operationId: get_custom_aggregations_for_workspace security: - OAuth2AuthorizationCode: - workspace_list_custom_aggregations parameters: - name: workspace_id in: path required: true schema: type: string format: uuid title: Workspace Id - name: page in: query required: false schema: type: integer description: The page number to fetch. default: 1 title: Page description: The page number to fetch. - name: page_size in: query required: false schema: type: integer description: The number of items per page. default: 10 title: Page Size description: The number of items per page. - name: search in: query required: false schema: anyOf: - type: string - type: 'null' description: Search for custom aggregations by aggregation name or description. title: Search description: Search for custom aggregations by aggregation name or description. responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/ResourceList_CustomAggregationSpecSchema_' '500': content: application/json: schema: $ref: '#/components/schemas/InternalServerError' description: Internal Server Error '404': content: application/json: schema: $ref: '#/components/schemas/NotFoundError' description: Not Found '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /api/v1/workspaces/{workspace_id}/validate_custom_aggregation: post: tags: - Custom Aggregations V1 summary: Validate A Custom Aggregation Before Creation. description: Validates the custom aggregation and returns any expected errors for aggregation creation. Requires workspace_validate_custom_aggregation permission. operationId: validate_custom_aggregation security: - OAuth2AuthorizationCode: - workspace_validate_custom_aggregation parameters: - name: workspace_id in: path required: true schema: type: string format: uuid title: Workspace Id requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PostCustomAggregationSpecSchema' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/ValidationResults' '500': content: application/json: schema: $ref: '#/components/schemas/InternalServerError' description: Internal Server Error '404': content: application/json: schema: $ref: '#/components/schemas/NotFoundError' description: Not Found '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' /api/v1/custom_aggregations/{custom_aggregation_id}: put: tags: - Custom Aggregations V1 summary: Update Custom Aggregation By Id. description: Creates a new version of the custom aggregation. Requires custom_aggregation_put permission. operationId: put_custom_aggregation security: - OAuth2AuthorizationCode: - custom_aggregation_put parameters: - name: custom_aggregation_id in: path required: true schema: type: string format: uuid title: Custom Aggregation Id requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PutCustomAggregationSpecSchema' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/CustomAggregationSpecSchema' '500': content: application/json: schema: $ref: '#/components/schemas/InternalServerError' description: Internal Server Error '404': content: application/json: schema: $ref: '#/components/schemas/NotFoundError' description: Not Found '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' delete: tags: - Custom Aggregations V1 summary: Delete Custom Aggregation. description: Requires custom_aggregation_delete permission. Aggregation will no longer be available to execute but will still be available to read. operationId: delete_custom_aggregation security: - OAuth2AuthorizationCode: - custom_aggregation_delete parameters: - name: custom_aggregation_id in: path required: true schema: type: string format: uuid title: Custom Aggregation Id responses: '204': description: Successful Response '500': content: application/json: schema: $ref: '#/components/schemas/InternalServerError' description: Internal Server Error '404': content: application/json: schema: $ref: '#/components/schemas/NotFoundError' description: Not Found '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' get: tags: - Custom Aggregations V1 summary: Get Custom Aggregation By Id. description: Requires custom_aggregation_read permission. Includes version filters to specify the versions included on the returned aggregation. operationId: get_custom_aggregation security: - OAuth2AuthorizationCode: - custom_aggregation_read parameters: - name: custom_aggregation_id in: path required: true schema: type: string format: uuid title: Custom Aggregation Id - name: version in: query required: false schema: anyOf: - type: integer - type: 'null' description: The version of the custom aggregation to fetch. title: Version description: The version of the custom aggregation to fetch. - name: latest in: query required: false schema: type: boolean description: Whether to fetch the latest version of the custom aggregation. default: false title: Latest description: Whether to fetch the latest version of the custom aggregation. responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/CustomAggregationSpecSchema' '500': content: application/json: schema: $ref: '#/components/schemas/InternalServerError' description: Internal Server Error '404': content: application/json: schema: $ref: '#/components/schemas/NotFoundError' description: Not Found '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' patch: tags: - Custom Aggregations V1 summary: Patch Custom Aggregation description: Requires custom_aggregation_update permission. operationId: patch_custom_aggregation security: - OAuth2AuthorizationCode: - custom_aggregation_update parameters: - name: custom_aggregation_id in: path required: true schema: type: string format: uuid title: Custom Aggregation Id requestBody: required: true content: application/json: schema: $ref: '#/components/schemas/PatchCustomAggregationSpecSchema' responses: '200': description: Successful Response content: application/json: schema: $ref: '#/components/schemas/CustomAggregationSpecSchema' '500': content: application/json: schema: $ref: '#/components/schemas/InternalServerError' description: Internal Server Error '404': content: application/json: schema: $ref: '#/components/schemas/NotFoundError' description: Not Found '422': description: Validation Error content: application/json: schema: $ref: '#/components/schemas/HTTPValidationError' components: schemas: ScalarType: properties: dtype: $ref: '#/components/schemas/DType' type: object required: - dtype title: ScalarType PutCustomAggregationSpecSchema: properties: reported_aggregations: items: $ref: '#/components/schemas/ReportedCustomAggregation' type: array title: Reported Aggregations description: Metadata for every aggregation the custom aggregation reports. aggregate_args: items: anyOf: - $ref: '#/components/schemas/BaseDatasetParameterSchema' - $ref: '#/components/schemas/BaseLiteralParameterSchema' - $ref: '#/components/schemas/BaseColumnParameterSchema' type: array title: Aggregate Args description: List of parameters to the custom aggregation's query function. sql: type: string title: Sql description: DuckDBSQL query for the custom aggregation. type: object required: - reported_aggregations - aggregate_args - sql title: PutCustomAggregationSpecSchema 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 User: properties: created_at: type: string format: date-time title: Created At description: Time of record creation. updated_at: type: string format: date-time title: Updated At description: Time of last record update. organization_id: type: string format: uuid4 title: Organization Id description: The ID of the Arthur organization the user belongs to. id: type: string format: uuid4 title: Id description: Unique user ID assigned by Arthur. first_name: type: string title: First Name description: The user's first name. last_name: anyOf: - type: string - type: 'null' title: Last Name description: The user's last name. email: anyOf: - type: string format: email - type: 'null' title: Email description: The user's email, if provided. picture: anyOf: - type: string - type: 'null' title: Picture description: A url to the user's profile picture, if one exists. user_type: $ref: '#/components/schemas/UserType' description: The type of user. data_plane_id: anyOf: - type: string format: uuid - type: 'null' title: Data Plane Id description: Arthur data plane ID. Only set for data plane users. client_id: anyOf: - type: string - type: 'null' title: Client Id description: Arthur client ID for this user. Only set for service account type users. organization_name: type: string title: Organization Name description: Name of user's Arthur organization. type: object required: - created_at - updated_at - organization_id - id - first_name - last_name - user_type - organization_name title: User ObjectType: properties: object: additionalProperties: anyOf: - $ref: '#/components/schemas/ScalarType' - $ref: '#/components/schemas/ObjectType' - $ref: '#/components/schemas/ListType' type: object title: Object type: object required: - object title: ObjectType AggregationMetricType: type: string enum: - sketch - numeric title: AggregationMetricType HTTPValidationError: properties: detail: items: $ref: '#/components/schemas/ValidationError' type: array title: Detail type: object title: HTTPValidationError BaseColumnParameterSchema: properties: parameter_key: type: string title: Parameter Key description: Name of the parameter. friendly_name: type: string title: Friendly Name description: User facing name of the parameter. description: type: string title: Description description: Description of the parameter. tag_hints: items: $ref: '#/components/schemas/ScopeSchemaTag' type: array title: Tag Hints description: List of tags that are applicable to this parameter. Datasets with columns that have matching tags can be inferred this way. default: [] source_dataset_parameter_key: type: string title: Source Dataset Parameter Key description: Name of the parameter that provides the dataset to be used for this column. allowed_column_types: anyOf: - items: anyOf: - $ref: '#/components/schemas/ScalarType' - $ref: '#/components/schemas/ObjectType' - $ref: '#/components/schemas/ListType' type: array - type: 'null' title: Allowed Column Types description: List of column types applicable to this parameter allow_any_column_type: type: boolean title: Allow Any Column Type description: Indicates if this metric parameter can accept any column type. default: false parameter_type: type: string const: column title: Parameter Type default: column type: object required: - parameter_key - friendly_name - description - source_dataset_parameter_key title: BaseColumnParameterSchema CustomAggregationVersionSpecSchema: properties: custom_aggregation_id: type: string format: uuid title: Custom Aggregation Id description: ID of parent custom aggregation. version: type: integer title: Version description: Version number of the custom aggregation function. authored_by: anyOf: - $ref: '#/components/schemas/User' - type: 'null' description: User who authored this custom aggregation. Will only be None if the author user has been deleted. created_at: type: string format: date-time title: Created At description: Time of aggregation creation. reported_aggregations: items: $ref: '#/components/schemas/ReportedCustomAggregation' type: array minItems: 1 title: Reported Aggregations description: Metadata for every aggregation the custom aggregation reports. aggregate_args: items: anyOf: - $ref: '#/components/schemas/BaseDatasetParameterSchema' - $ref: '#/components/schemas/BaseLiteralParameterSchema' - $ref: '#/components/schemas/BaseColumnParameterSchema' type: array title: Aggregate Args description: List of parameters to the custom aggregation's query function. sql: type: string title: Sql description: DuckDBSQL query for the custom aggregation. type: object required: - custom_aggregation_id - version - authored_by - created_at - reported_aggregations - aggregate_args - sql title: CustomAggregationVersionSpecSchema PostCustomAggregationSpecSchema: properties: reported_aggregations: items: $ref: '#/components/schemas/ReportedCustomAggregation' type: array title: Reported Aggregations description: Metadata for every aggregation the custom aggregation reports. aggregate_args: items: anyOf: - $ref: '#/components/schemas/BaseDatasetParameterSchema' - $ref: '#/components/schemas/BaseLiteralParameterSchema' - $ref: '#/components/schemas/BaseColumnParameterSchema' title: CustomAggregationVersionSpecSchemaAggregateArgsInner type: array title: Aggregate Args description: List of parameters to the custom aggregation's query function. sql: type: string title: Sql description: DuckDBSQL query for the custom aggregation. name: type: string title: Name description: Name of the custom aggregation function. description: anyOf: - type: string - type: 'null' title: Description description: Description of the custom aggregation function and what it aggregates. type: object required: - reported_aggregations - aggregate_args - sql - name title: PostCustomAggregationSpecSchema NotFoundError: properties: detail: type: string title: Detail default: Resource not found type: object title: NotFoundError ListType: properties: items: anyOf: - $ref: '#/components/schemas/ScalarType' - $ref: '#/components/schemas/ObjectType' - $ref: '#/components/schemas/ListType' title: Items type: object required: - items title: ListType InternalServerError: properties: detail: type: string title: Detail default: Internal server error type: object title: InternalServerError ValidationResult: properties: validation_description: type: string title: Validation Description description: Description of validation requirement. validation_outcome: $ref: '#/components/schemas/ValidationOutcome' description: Outcome of the validation requirement. type: object required: - validation_description - validation_outcome title: ValidationResult description: Generic class to indicate a single validation and its outcome. ValidationOutcome: type: string enum: - pass - fail title: ValidationOutcome description: Generic class to indicate if a validation passed or failed. BadRequestError: properties: detail: type: string title: Detail default: Bad Request type: object title: BadRequestError ReportedCustomAggregation: properties: metric_name: type: string title: Metric Name description: Name of the reported aggregation metric. description: type: string title: Description description: Description of the reported aggregation metric and what it aggregates. value_column: type: string title: Value Column description: Name of the column returned from the SQL query holding the metric value. timestamp_column: type: string title: Timestamp Column description: Name of the column returned from the SQL query holding the timestamp buckets. metric_kind: $ref: '#/components/schemas/AggregationMetricType' description: Return type of the reported aggregation metric value. dimension_columns: items: type: string type: array title: Dimension Columns description: Name of any dimension columns returned from the SQL query. Max length is 1. type: object required: - metric_name - description - value_column - timestamp_column - metric_kind - dimension_columns title: ReportedCustomAggregation ScopeSchemaTag: type: string enum: - llm_context - llm_prompt - llm_response - primary_timestamp - categorical - continuous - prediction - ground_truth - pin_in_deep_dive - possible_segmentation title: ScopeSchemaTag UserType: type: string enum: - user - data_plane - service_account title: UserType Pagination: properties: page: type: integer title: Page description: The current page number. Page 1 is the first page. default: 1 page_size: type: integer title: Page Size description: Number of records per page. default: 20 total_pages: type: integer title: Total Pages description: Total number of pages. total_records: type: integer title: Total Records description: Total number of records across all pages. type: object required: - total_pages - total_records title: Pagination ModelProblemType: type: string enum: - regression - binary_classification - arthur_shield - custom - multiclass_classification - agentic_trace title: ModelProblemType PatchCustomAggregationSpecSchema: properties: name: anyOf: - type: string - type: 'null' title: Name description: Name of the updated custom aggregation. description: anyOf: - type: string - type: 'null' title: Description description: Updated description of the custom aggregation. type: object title: PatchCustomAggregationSpecSchema ResourceList_CustomAggregationSpecSchema_: properties: records: items: $ref: '#/components/schemas/CustomAggregationSpecSchema' type: array title: Records description: List of records. pagination: $ref: '#/components/schemas/Pagination' description: Pagination information. type: object required: - records - pagination title: ResourceList[CustomAggregationSpecSchema] ValidationResults: properties: validation_results: items: $ref: '#/components/schemas/ValidationResult' type: array title: Validation Results type: object required: - validation_results title: ValidationResults description: This class is a generic class for any endpoints returning multiple validation errors. CustomAggregationSpecSchema: properties: id: type: string format: uuid title: Id description: Unique identifier of the custom aggregation with version. name: type: string title: Name description: Name of the custom aggregation function. description: anyOf: - type: string - type: 'null' title: Description description: Description of the custom aggregation function and what it aggregates. workspace_id: type: string format: uuid title: Workspace Id description: Unique identifier of the custom aggregation's parent workspace. versions: items: $ref: '#/components/schemas/CustomAggregationVersionSpecSchema' type: array title: Versions description: List of versions of the custom aggregation configuration. latest_version: type: integer title: Latest Version description: Max/latest version of the custom aggregation that exists. This version may or may not be included in the list of versions depending on applied filters. deleted_at: anyOf: - type: string format: date-time - type: 'null' title: Deleted At description: Time of aggregation deletion. is_deleted: type: boolean title: Is Deleted description: Flag indicating if the aggregation has been soft deleted. default: false type: object required: - id - name - workspace_id - versions - latest_version title: CustomAggregationSpecSchema BaseDatasetParameterSchema: properties: parameter_key: type: string title: Parameter Key description: Name of the parameter. friendly_name: type: string title: Friendly Name description: User facing name of the parameter. description: type: string title: Description description: Description of the parameter. parameter_type: type: string const: dataset title: Parameter Type default: dataset model_problem_type: anyOf: - $ref: '#/components/schemas/ModelProblemType' - type: 'null' description: Model problem type of the parameter. If not set, any model problem type is allowed. type: object required: - parameter_key - friendly_name - description title: BaseDatasetParameterSchema DType: type: string enum: - undefined - int - float - bool - str - uuid - timestamp - date - json - image title: DType BaseLiteralParameterSchema: properties: parameter_key: type: string title: Parameter Key description: Name of the parameter. friendly_name: type: string title: Friendly Name description: User facing name of the parameter. description: type: string title: Description description: Description of the parameter. parameter_type: type: string const: literal title: Parameter Type default: literal parameter_dtype: $ref: '#/components/schemas/DType' description: Data type of the parameter. type: object required: - parameter_key - friendly_name - description - parameter_dtype title: BaseLiteralParameterSchema securitySchemes: OAuth2AuthorizationCode: type: oauth2 flows: authorizationCode: refreshUrl: https://platform-auth.arthur.ai/realms/arthur/protocol/openid-connect/token scopes: {} authorizationUrl: https://platform-auth.arthur.ai/realms/arthur/protocol/openid-connect/auth tokenUrl: https://platform-auth.arthur.ai/realms/arthur/protocol/openid-connect/token