> ## Documentation Index
> Fetch the complete documentation index at: https://docs.dolphinflashcards.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Import flashcards from an Anki .apkg file

> Imports flashcards from an Anki deck package (.apkg) and stores them in the specified folder



## OpenAPI

````yaml post /import-anki-flashcards
openapi: 3.1.0
info:
  title: DolphinFlashcardApp API
  version: '1.0'
  summary: Manage flashcards
  description: >-
    Set up user accounts, create or manage flashcards, set learning goals, and
    track performances with user's heatmap and streak data. Data is available in
    JSON format only. <br></br>**Note**: All parameters are case-sensitive.
    Request body parameters are required, but the query parameters are
    optional. 
  contact:
    name: Dolphin Flashcards
    url: https://dolphinflashcards.com/contact
    email: dolphinflashcards@outlook.com
  license:
    name: MIT
    url: https://github.com/jacob-macleod/Dolphin-Flashcard-App/blob/main/LICENSE
servers:
  - url: http://dolphinflashcards.com/api
    description: baseurl
security: []
tags:
  - name: Account
    description: Groups the endpoints required to create an account.
  - name: Card management
    description: Groups the endpoints required to create and manage flashcards.
  - name: Goal
    description: Groups the endpoints required to create and manage goals.
  - name: Statistics
    description: Groups the endpoints required to track heatmap and streak.
paths:
  /import-anki-flashcards:
    post:
      tags:
        - Card management
      summary: Import flashcards from an Anki .apkg file
      description: >-
        Imports flashcards from an Anki deck package (.apkg) and stores them in
        the specified folder
      operationId: import-anki-flashcards
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
                - jwtToken
                - flashcardName
              properties:
                file:
                  type: string
                  format: binary
                  description: Anki .apkg file containing the flashcards
                jwtToken:
                  type: string
                  description: JWT authentication token
                  example: >-
                    eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySUQiOiIxMjM0NSJ9.abc123...
                folder:
                  type: string
                  description: Folder path to store the flashcards (empty string for root)
                  default: ''
                  example: Languages/Spanish
                flashcardName:
                  type: string
                  description: Name for the new flashcard set
                  example: Spanish Vocabulary
                flashcardDescription:
                  type: string
                  description: Optional description for the flashcard set
                  example: Imported from Anki deck
                termField:
                  type: string
                  description: Term field name (e.g., "Front") or index (0-based integer)
                  default: Front
                  example: Front
                definitionField:
                  type: string
                  description: >-
                    Definition field name (e.g., "Back") or index (0-based
                    integer)
                  default: Back
                  example: Back
                stripHtml:
                  type: string
                  description: >-
                    Whether to remove HTML tags from fields ("true" or "false"
                    as string)
                  default: 'true'
                  example: 'true'
      responses:
        '200':
          description: Successfully imported flashcards
          content:
            application/json:
              schema:
                type: object
                properties:
                  flashcardID:
                    type: string
                    description: ID of the created flashcard set
                    example: '987654321'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    examples:
                      noFile: No file provided
                      invalidFormat: Invalid Anki file format
                      exists: Flashcard set name already exists
                      noValidCards: |-
                        No valid flashcards found. Possible reasons:
                        1. Incorrect field selection
                        2. All content was removed during HTML stripping
                        3. Unsupported Anki note type
        '500':
          description: Internal server error
          content:
            application/json:
              schema:
                type: object
                properties:
                  error:
                    type: string
                    example: Internal server error occurred

````