diff --git a/404.html b/404.html index ae58151..1b1bba7 100644 --- a/404.html +++ b/404.html @@ -9,14 +9,15 @@ - + +
- + \ No newline at end of file diff --git a/SUMMARY.html b/SUMMARY.html index c0dc41f..f76eb52 100644 --- a/SUMMARY.html +++ b/SUMMARY.html @@ -9,17 +9,18 @@ - + - + + -
Skip to content
- +
Skip to content
+ \ No newline at end of file diff --git a/api/archived-email.html b/api/archived-email.html index bd72d19..786de26 100644 --- a/api/archived-email.html +++ b/api/archived-email.html @@ -9,16 +9,17 @@ - + - + + -
Skip to content

Archived Email Service API

The Archived Email Service is responsible for retrieving archived emails and their details from the database and storage.

Endpoints

All endpoints in this service require authentication.

GET /api/v1/archived-emails/ingestion-source/:ingestionSourceId

Retrieves a paginated list of archived emails for a specific ingestion source.

Access: Authenticated

URL Parameters

ParameterTypeDescription
ingestionSourceIdstringThe ID of the ingestion source to get emails for.

Query Parameters

ParameterTypeDescriptionDefault
pagenumberThe page number for pagination.1
limitnumberThe number of items per page.10

Responses

  • 200 OK: A paginated list of archived emails.

    json
    {
    +    
    Skip to content

    Archived Email Service API

    The Archived Email Service is responsible for retrieving archived emails and their details from the database and storage.

    Endpoints

    All endpoints in this service require authentication.

    GET /api/v1/archived-emails/ingestion-source/:ingestionSourceId

    Retrieves a paginated list of archived emails for a specific ingestion source.

    Access: Authenticated

    URL Parameters

    ParameterTypeDescription
    ingestionSourceIdstringThe ID of the ingestion source to get emails for.

    Query Parameters

    ParameterTypeDescriptionDefault
    pagenumberThe page number for pagination.1
    limitnumberThe number of items per page.10

    Responses

    • 200 OK: A paginated list of archived emails.

      json
      {
           "items": [
               {
                   "id": "email-id",
      @@ -53,7 +54,7 @@
               }
           ]
       }
    • 404 Not Found: The archived email with the specified ID was not found.

    • 500 Internal Server Error: An unexpected error occurred.

    Service Methods

    getArchivedEmails(ingestionSourceId: string, page: number, limit: number): Promise<PaginatedArchivedEmails>

    Retrieves a paginated list of archived emails from the database for a given ingestion source.

    • ingestionSourceId: The ID of the ingestion source.
    • page: The page number for pagination.
    • limit: The number of items per page.
    • Returns: A promise that resolves to a PaginatedArchivedEmails object.

    getArchivedEmailById(emailId: string): Promise<ArchivedEmail | null>

    Retrieves a single archived email by its ID, including its raw content and attachments.

    • emailId: The ID of the archived email.
    • Returns: A promise that resolves to an ArchivedEmail object or null if not found.
    - + \ No newline at end of file diff --git a/api/auth.html b/api/auth.html index 8850a5d..fa89e01 100644 --- a/api/auth.html +++ b/api/auth.html @@ -9,16 +9,17 @@ - + - + + -
    Skip to content

    Auth Service API

    The Auth Service is responsible for handling user authentication, including login and token verification.

    Endpoints

    POST /api/v1/auth/login

    Authenticates a user and returns a JWT if the credentials are valid.

    Access: Public

    Rate Limiting: This endpoint is rate-limited to prevent brute-force attacks.

    Request Body

    FieldTypeDescription
    emailstringThe user's email address.
    passwordstringThe user's password.

    Responses

    • 200 OK: Authentication successful.

      json
      {
      +    
      Skip to content

      Auth Service API

      The Auth Service is responsible for handling user authentication, including login and token verification.

      Endpoints

      POST /api/v1/auth/login

      Authenticates a user and returns a JWT if the credentials are valid.

      Access: Public

      Rate Limiting: This endpoint is rate-limited to prevent brute-force attacks.

      Request Body

      FieldTypeDescription
      emailstringThe user's email address.
      passwordstringThe user's password.

      Responses

      • 200 OK: Authentication successful.

        json
        {
             "accessToken": "your.jwt.token",
             "user": {
                 "id": "user-id",
        @@ -32,7 +33,7 @@
         }
      • 500 Internal Server Error: An unexpected error occurred.

        json
        {
             "message": "An internal server error occurred"
         }

      Service Methods

      verifyPassword(password: string, hash: string): Promise<boolean>

      Compares a plain-text password with a hashed password to verify its correctness.

      • password: The plain-text password.
      • hash: The hashed password to compare against.
      • Returns: A promise that resolves to true if the password is valid, otherwise false.

      login(email: string, password: string): Promise<LoginResponse | null>

      Handles the user login process. It finds the user by email, verifies the password, and generates a JWT upon successful authentication.

      • email: The user's email.
      • password: The user's password.
      • Returns: A promise that resolves to a LoginResponse object containing the accessToken and user details, or null if authentication fails.

      verifyToken(token: string): Promise<AuthTokenPayload | null>

      Verifies the authenticity and expiration of a JWT.

      • token: The JWT string to verify.
      • Returns: A promise that resolves to the token's AuthTokenPayload if valid, otherwise null.
      - + \ No newline at end of file diff --git a/api/authentication.html b/api/authentication.html index 8ecbf74..b07e2f6 100644 --- a/api/authentication.html +++ b/api/authentication.html @@ -9,16 +9,17 @@ - + - + + -
      Skip to content

      API Authentication

      To access protected API endpoints, you need to include a JSON Web Token (JWT) in the Authorization header of your requests.

      Obtaining a JWT

      First, you need to authenticate with the /api/v1/auth/login endpoint by providing your email and password. If the credentials are correct, the API will return an accessToken.

      Request:

      http
      POST /api/v1/auth/login
      +    
      Skip to content

      API Authentication

      To access protected API endpoints, you need to include a JSON Web Token (JWT) in the Authorization header of your requests.

      Obtaining a JWT

      First, you need to authenticate with the /api/v1/auth/login endpoint by providing your email and password. If the credentials are correct, the API will return an accessToken.

      Request:

      http
      POST /api/v1/auth/login
       Content-Type: application/json
       
       {
      @@ -34,7 +35,7 @@
       }

      Making Authenticated Requests

      Once you have the accessToken, you must include it in the Authorization header of all subsequent requests to protected endpoints, using the Bearer scheme.

      Example:

      http
      GET /api/v1/dashboard/stats
       Authorization: Bearer your.jwt.token

      If the token is missing, expired, or invalid, the API will respond with a 401 Unauthorized status code.

      Using a Super API Key

      Alternatively, for server-to-server communication or scripts, you can use a super API key. This key provides unrestricted access to the API and should be kept secret.

      You can set the SUPER_API_KEY in your .env file.

      To authenticate using the super API key, include it in the Authorization header as a Bearer token.

      Example:

      http
      GET /api/v1/dashboard/stats
       Authorization: Bearer your-super-secret-api-key
      - + \ No newline at end of file diff --git a/api/dashboard.html b/api/dashboard.html index d69ad43..4915f0f 100644 --- a/api/dashboard.html +++ b/api/dashboard.html @@ -9,16 +9,17 @@ - + - + + -
      Skip to content

      Dashboard Service API

      The Dashboard Service provides endpoints for retrieving statistics and data for the main dashboard.

      Endpoints

      All endpoints in this service require authentication.

      GET /api/v1/dashboard/stats

      Retrieves overall statistics, including the total number of archived emails, total storage used, and the number of failed ingestions in the last 7 days.

      Access: Authenticated

      Responses

      • 200 OK: An object containing the dashboard statistics.

        json
        {
        +    
        Skip to content

        Dashboard Service API

        The Dashboard Service provides endpoints for retrieving statistics and data for the main dashboard.

        Endpoints

        All endpoints in this service require authentication.

        GET /api/v1/dashboard/stats

        Retrieves overall statistics, including the total number of archived emails, total storage used, and the number of failed ingestions in the last 7 days.

        Access: Authenticated

        Responses

        • 200 OK: An object containing the dashboard statistics.

          json
          {
               "totalEmailsArchived": 12345,
               "totalStorageUsed": 54321098,
               "failedIngestionsLast7Days": 3
          @@ -56,7 +57,7 @@
                   }
               ]
           }
        - + \ No newline at end of file diff --git a/api/index.html b/api/index.html index 979b454..0727244 100644 --- a/api/index.html +++ b/api/index.html @@ -9,17 +9,18 @@ - + - + + -
        Skip to content

        API Overview

        Welcome to the Open Archiver API documentation. This section provides detailed information about the available API endpoints.

        All API endpoints are prefixed with /api/v1.

        Authentication

        Before making requests to protected endpoints, you must authenticate with the API. See the Authentication Guide for details on how to obtain and use API tokens.

        API Services

        - +
        Skip to content

        API Overview

        Welcome to the Open Archiver API documentation. This section provides detailed information about the available API endpoints.

        All API endpoints are prefixed with /api/v1.

        Authentication

        Before making requests to protected endpoints, you must authenticate with the API. See the Authentication Guide for details on how to obtain and use API tokens.

        API Services

        + \ No newline at end of file diff --git a/api/ingestion.html b/api/ingestion.html index baa11db..9aab053 100644 --- a/api/ingestion.html +++ b/api/ingestion.html @@ -9,16 +9,17 @@ - + - + + -
        Skip to content

        Ingestion Service API

        The Ingestion Service manages ingestion sources, which are configurations for connecting to email providers and importing emails.

        Endpoints

        All endpoints in this service require authentication.

        POST /api/v1/ingestion

        Creates a new ingestion source.

        Access: Authenticated

        Request Body

        The request body should be a CreateIngestionSourceDto object.

        typescript
        interface CreateIngestionSourceDto {
        +    
        Skip to content

        Ingestion Service API

        The Ingestion Service manages ingestion sources, which are configurations for connecting to email providers and importing emails.

        Endpoints

        All endpoints in this service require authentication.

        POST /api/v1/ingestion

        Creates a new ingestion source.

        Access: Authenticated

        Request Body

        The request body should be a CreateIngestionSourceDto object.

        typescript
        interface CreateIngestionSourceDto {
             name: string;
             provider: 'google' | 'microsoft' | 'generic_imap';
             providerConfig: IngestionCredentials;
        @@ -34,7 +35,7 @@
                 | 'paused'
                 | 'error';
         }

        Responses

        • 200 OK: The updated ingestion source object.
        • 404 Not Found: Ingestion source not found.
        • 500 Internal Server Error: An unexpected error occurred.

        DELETE /api/v1/ingestion/:id

        Deletes an ingestion source and all associated data.

        Access: Authenticated

        URL Parameters

        ParameterTypeDescription
        idstringThe ID of the ingestion source.

        Responses

        • 204 No Content: The ingestion source was deleted successfully.
        • 404 Not Found: Ingestion source not found.
        • 500 Internal Server Error: An unexpected error occurred.

        POST /api/v1/ingestion/:id/import

        Triggers the initial import process for an ingestion source.

        Access: Authenticated

        URL Parameters

        ParameterTypeDescription
        idstringThe ID of the ingestion source.

        Responses

        • 202 Accepted: The initial import was triggered successfully.
        • 404 Not Found: Ingestion source not found.
        • 500 Internal Server Error: An unexpected error occurred.

        POST /api/v1/ingestion/:id/pause

        Pauses an active ingestion source.

        Access: Authenticated

        URL Parameters

        ParameterTypeDescription
        idstringThe ID of the ingestion source.

        Responses

        • 200 OK: The updated ingestion source object with a paused status.
        • 404 Not Found: Ingestion source not found.
        • 500 Internal Server Error: An unexpected error occurred.

        POST /api/v1/ingestion/:id/sync

        Triggers a forced synchronization for an ingestion source.

        Access: Authenticated

        URL Parameters

        ParameterTypeDescription
        idstringThe ID of the ingestion source.

        Responses

        • 202 Accepted: The force sync was triggered successfully.
        • 404 Not Found: Ingestion source not found.
        • 500 Internal Server Error: An unexpected error occurred.
        - + \ No newline at end of file diff --git a/api/search.html b/api/search.html index af99ddc..f63bba2 100644 --- a/api/search.html +++ b/api/search.html @@ -9,16 +9,17 @@ - + - + + -
        Skip to content