{
  "openapi": "3.0.0",
  "info": {
    "contact": {
      "email": "support@enad.io",
      "name": "API Support"
    },
    "description": "This is the swagger for Enads Digital Assets Management service",
    "license": {
      "name": "Apache 2.0",
      "url": "http://www.apache.org/licenses/LICENSE-2.0.html"
    },
    "termsOfService": "http://enad.io/terms",
    "title": "Digital Assets Management",
    "version": "1.0"
  },
  "paths": {
    "/api/v1/{app_id}/folders": {
      "get": {
        "description": "Fetch the folder contents by ID",
        "parameters": [
          {
            "description": "App id",
            "in": "path",
            "name": "app_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Folders",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OkResponseFolder"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request (e.g. bad UUID, validation error)",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "BearerAuth": []
          }
        ],
        "summary": "Fetch the folder contents by ID",
        "tags": [
          "Folders"
        ]
      }
    },
    "/api/v1/{app_id}/folders/{folder_id}/media/{media_id}": {
      "get": {
        "description": "Retrieves a media item (image, video, or file) by its ID",
        "parameters": [
          {
            "description": "App ID",
            "in": "path",
            "name": "app_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Folder ID",
            "in": "path",
            "name": "folder_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Media ID",
            "in": "path",
            "name": "media_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Media item retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OkResponseMediaItem"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "403": {
            "description": "Forbidden: Folder is not public",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Media item not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Get Media Item by ID",
        "tags": [
          "Media"
        ]
      }
    },
    "/api/v1/{app_id}/folders/{id}/contents": {
      "get": {
        "description": "Retrieves paginated, filtered, and sorted media items in a folder",
        "parameters": [
          {
            "description": "App ID",
            "in": "path",
            "name": "app_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Folder ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Page number (default: 1)",
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Items per page (default: 20, max: 100)",
            "in": "query",
            "name": "per_page",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Filter by type: image, video, file, all (default: all)",
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Sort field: name, created_at, updated_at, type (default: created_at)",
            "in": "query",
            "name": "sort_by",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Sort order: asc, desc (default: desc)",
            "in": "query",
            "name": "sort_order",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter by attribute(s) in format: template_key/attr_key (comma-separated for multiple attributes)",
            "in": "query",
            "name": "attributes",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Folder contents",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/internal_pkg_webserver_v1.OkResponseFolderContents"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Folder not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Get Folder Contents",
        "tags": [
          "Folders"
        ]
      }
    },
    "/api/v1/{app_id}/folders/{id}/tree": {
      "get": {
        "description": "Retrieves a folder tree starting from a specific folder",
        "parameters": [
          {
            "description": "App ID",
            "in": "path",
            "name": "app_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Folder ID",
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Folder tree retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OkResponseFolderTreeItem"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "401": {
            "description": "Unauthorized access",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Folder not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Get Folder Tree from Path",
        "tags": [
          "Folders"
        ]
      }
    },
    "/api/v1/{app_id}/folders/public": {
      "get": {
        "description": "Retrieves a flat list of public folders with pagination",
        "parameters": [
          {
            "description": "App ID",
            "in": "path",
            "name": "app_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Page number (default: 1)",
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Items per page (default: 20, max: 100)",
            "in": "query",
            "name": "per_page",
            "schema": {
              "type": "integer"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Public folders retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OkResponsePublicFolders"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Get Public Folders",
        "tags": [
          "Folders"
        ]
      }
    },
    "/api/v1/{app_id}/folders/tree": {
      "get": {
        "description": "Retrieves the complete folder hierarchy starting from the root folder",
        "parameters": [
          {
            "description": "App ID",
            "in": "path",
            "name": "app_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Full folder tree",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/internal_pkg_webserver_v1.OkResponseFullFolderTree"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Root folder not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "security": [
          {
            "BearerAuth": []
          }
        ],
        "summary": "Get Full Folder Tree",
        "tags": [
          "Folders"
        ]
      }
    },
    "/api/v1/{app_id}/shareable-links/{token}/folder/{folder_id}/media": {
      "get": {
        "description": "Retrieves media items from a specific folder that belongs to a shareable link with pagination, filtering, and sorting",
        "parameters": [
          {
            "description": "Shareable Link Token",
            "in": "path",
            "name": "token",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Folder ID",
            "in": "path",
            "name": "folder_id",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Page number (default: 1)",
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Items per page (default: 20, max: 100)",
            "in": "query",
            "name": "per_page",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Filter by type: image, video, file, all (default: all)",
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Sort field: name, created_at, updated_at, type (default: created_at)",
            "in": "query",
            "name": "sort_by",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Sort order: asc, desc (default: desc)",
            "in": "query",
            "name": "sort_order",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter by attribute(s) in format: template_key/attr_key (comma-separated for multiple attributes)",
            "in": "query",
            "name": "attributes",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Folder media retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OkResponseShareableLinkMedia"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Shareable link or folder not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "summary": "Get Shareable Link Folder Media",
        "tags": [
          "Shareable Links"
        ]
      }
    },
    "/api/v1/{app_id}/shareable-links/{token}/folders": {
      "get": {
        "description": "Retrieves the list of folders associated with a shareable link with pagination and sorting",
        "parameters": [
          {
            "description": "Shareable Link Token",
            "in": "path",
            "name": "token",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Page number (default: 1)",
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Items per page (default: 20, max: 100)",
            "in": "query",
            "name": "per_page",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Sort field: name, created_at, updated_at (default: created_at)",
            "in": "query",
            "name": "sort_by",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Sort order: asc, desc (default: desc)",
            "in": "query",
            "name": "sort_order",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Shareable link folders retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OkResponseShareableLinkFolders"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Shareable link not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "summary": "Get Shareable Link Folders",
        "tags": [
          "Shareable Links"
        ]
      }
    },
    "/api/v1/{app_id}/shareable-links/{token}/media": {
      "get": {
        "description": "Retrieves all media items (from direct links and folders) associated with a shareable link with pagination, filtering, and sorting",
        "parameters": [
          {
            "description": "Shareable Link Token",
            "in": "path",
            "name": "token",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Page number (default: 1)",
            "in": "query",
            "name": "page",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Items per page (default: 20, max: 100)",
            "in": "query",
            "name": "per_page",
            "schema": {
              "type": "integer"
            }
          },
          {
            "description": "Filter by type: image, video, file, all (default: all)",
            "in": "query",
            "name": "type",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Sort field: name, created_at, updated_at, type (default: created_at)",
            "in": "query",
            "name": "sort_by",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Sort order: asc, desc (default: desc)",
            "in": "query",
            "name": "sort_order",
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Filter by attribute(s) in format: template_key/attr_key (comma-separated for multiple attributes)",
            "in": "query",
            "name": "attributes",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Shareable link media retrieved successfully",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OkResponseShareableLinkMedia"
                }
              }
            }
          },
          "400": {
            "description": "Invalid request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "404": {
            "description": "Shareable link not found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          },
          "500": {
            "description": "Internal server error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorResponse"
                }
              }
            }
          }
        },
        "summary": "Get Shareable Link Media",
        "tags": [
          "Shareable Links"
        ]
      }
    }
  },
  "servers": [
    {
      "url": "//dam.enad.io"
    }
  ],
  "components": {
    "schemas": {
      "AttributeResponse": {
        "properties": {
          "description": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "key": {
            "type": "string"
          },
          "name": {
            "type": "string"
          },
          "values": {
            "additionalProperties": {
              "items": {
                "$ref": "#/components/schemas/AttributeValueResponse"
              },
              "type": "array"
            },
            "type": "object"
          }
        },
        "type": "object"
      },
      "AttributeValueResponse": {
        "properties": {
          "type": {
            "type": "string"
          },
          "value": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "ErrorResponse": {
        "properties": {
          "details": {
            "items": {
              "type": "string"
            },
            "type": "array"
          },
          "error": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "FolderResponse": {
        "properties": {
          "created_at": {
            "type": "string"
          },
          "file_count": {
            "type": "integer"
          },
          "has_content_access": {
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "image_count": {
            "type": "integer"
          },
          "is_default": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "parent_id": {
            "type": "string"
          },
          "public": {
            "type": "boolean"
          },
          "slug": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "video_count": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "FolderTreeResponse": {
        "properties": {
          "children": {
            "items": {
              "$ref": "#/components/schemas/FolderTreeResponse"
            },
            "type": "array"
          },
          "created_at": {
            "type": "string"
          },
          "file_count": {
            "type": "integer"
          },
          "has_content_access": {
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "image_count": {
            "type": "integer"
          },
          "is_default": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "parent_id": {
            "type": "string"
          },
          "public": {
            "type": "boolean"
          },
          "slug": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "video_count": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "OkResponseFolder": {
        "properties": {
          "data": {
            "$ref": "#/components/schemas/FolderResponse"
          },
          "success": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "OkResponseFolderTreeItem": {
        "properties": {
          "data": {
            "$ref": "#/components/schemas/FolderTreeResponse"
          },
          "success": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "OkResponseMediaItem": {
        "properties": {
          "data": {
            "$ref": "#/components/schemas/internal_pkg_webserver_v1.MediaItemResponse"
          },
          "success": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "OkResponsePublicFolders": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/FolderResponse"
            },
            "type": "array"
          },
          "pagination": {
            "$ref": "#/components/schemas/internal_pkg_webserver_v1.PageInfo"
          },
          "success": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "OkResponseShareableLinkFolders": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/FolderResponse"
            },
            "type": "array"
          },
          "pagination": {
            "$ref": "#/components/schemas/internal_pkg_webserver_v1.PageInfo"
          },
          "success": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "OkResponseShareableLinkMedia": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/internal_pkg_webserver_v1.MediaItemResponse"
            },
            "type": "array"
          },
          "pagination": {
            "$ref": "#/components/schemas/internal_pkg_webserver_v1.PageInfo"
          },
          "success": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "VideoVariantResponse": {
        "properties": {
          "created_at": {
            "type": "string"
          },
          "format": {
            "type": "string"
          },
          "height": {
            "type": "integer"
          },
          "id": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "width": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "internal_pkg_webserver_v1.FolderTreeItemResponse": {
        "properties": {
          "children": {
            "items": {
              "$ref": "#/components/schemas/internal_pkg_webserver_v1.FolderTreeItemResponse"
            },
            "type": "array"
          },
          "created_at": {
            "type": "string"
          },
          "file_count": {
            "type": "integer"
          },
          "has_content_access": {
            "type": "boolean"
          },
          "id": {
            "type": "string"
          },
          "image_count": {
            "type": "integer"
          },
          "is_default": {
            "type": "boolean"
          },
          "name": {
            "type": "string"
          },
          "parent_id": {
            "type": "string"
          },
          "public": {
            "type": "boolean"
          },
          "slug": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "video_count": {
            "type": "integer"
          }
        },
        "type": "object"
      },
      "internal_pkg_webserver_v1.MediaItemResponse": {
        "properties": {
          "alt_text": {
            "type": "string"
          },
          "attributes": {
            "items": {
              "$ref": "#/components/schemas/AttributeResponse"
            },
            "type": "array"
          },
          "blurhash": {
            "type": "string"
          },
          "copyright": {
            "type": "string"
          },
          "created_at": {
            "type": "string"
          },
          "custom": {
            "items": {
              "type": "integer"
            },
            "type": "array"
          },
          "description": {
            "type": "string"
          },
          "file_type": {
            "type": "string"
          },
          "folder_id": {
            "type": "string"
          },
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "translations": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object"
          },
          "type": {
            "type": "string"
          },
          "updated_at": {
            "type": "string"
          },
          "url": {
            "type": "string"
          },
          "variants": {
            "items": {
              "$ref": "#/components/schemas/VideoVariantResponse"
            },
            "type": "array"
          }
        },
        "type": "object"
      },
      "internal_pkg_webserver_v1.OkResponseFolderContents": {
        "properties": {
          "data": {
            "items": {
              "$ref": "#/components/schemas/internal_pkg_webserver_v1.MediaItemResponse"
            },
            "type": "array"
          },
          "pagination": {
            "$ref": "#/components/schemas/internal_pkg_webserver_v1.PageInfo"
          },
          "success": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "internal_pkg_webserver_v1.OkResponseFullFolderTree": {
        "properties": {
          "data": {
            "$ref": "#/components/schemas/internal_pkg_webserver_v1.FolderTreeItemResponse"
          },
          "success": {
            "type": "boolean"
          }
        },
        "type": "object"
      },
      "internal_pkg_webserver_v1.PageInfo": {
        "properties": {
          "page": {
            "type": "integer"
          },
          "per_page": {
            "type": "integer"
          },
          "total_items": {
            "type": "integer"
          },
          "total_pages": {
            "type": "integer"
          }
        },
        "type": "object"
      }
    }
  }
}
