### Database Migration Examples Source: https://github.com/forceu/gokapi/blob/master/docs/advanced.md Examples demonstrating migration between SQLite and Redis databases with various configurations. ```default gokapi migrate-database --source sqlite:///app/data/gokapi.sqlite --destination redis://127.0.0.1:6379 ``` ```default gokapi migrate-database --source sqlite:///app/data/gokapi.sqlite --destination sqlite://./data/gokapi.sqlite ``` ```default gokapi migrate-database --source "redis://test:1234@127.0.0.1:6379?prefix=gokapi_&ssl=true" --destination sqlite://./data/gokapi.sqlite ``` -------------------------------- ### Normal Server Start After Deployment Source: https://context7.com/forceu/gokapi/llms.txt This command starts the Gokapi server normally after the initial deployment setup, utilizing previously configured volumes. ```bash # Then start the server normally — no interactive setup needed docker run -d \ -v gokapi-data:/app/data \ -v gokapi-config:/app/config \ -p 127.0.0.1:53842:53842 \ -e TZ=UTC \ f0rc3/gokapi:latest ``` -------------------------------- ### Gokapi Environment Variables Example Source: https://context7.com/forceu/gokapi/llms.txt This example shows how to set environment variables for Gokapi using a .env file. Uncomment and modify variables as needed for your deployment. ```bash # .env example – uncomment and edit as needed TZ=UTC # --- Server --- # GOKAPI_PORT=53842 # Webserver port (persistent) # GOKAPI_CONFIG_DIR=config # Config file directory # GOKAPI_CONFIG_FILE=config.json # Config filename # GOKAPI_DATA_DIR=data # Data directory (persistent) # --- Uploads --- # GOKAPI_CHUNK_SIZE_MB=45 # Upload chunk size in MB (persistent) # GOKAPI_MAX_FILESIZE=102400 # Max file size in MB, default 100 GB (persistent) # GOKAPI_MAX_MEMORY_UPLOAD=50 # RAM per chunk in MB (persistent) # GOKAPI_MAX_PARALLEL_UPLOADS=3 # Parallel chunks per file (persistent) # GOKAPI_MIN_FREE_SPACE=400 # Min free disk space in MB before rejecting uploads # --- ID lengths --- # GOKAPI_LENGTH_ID=15 # Download ID length (min 5) # GOKAPI_LENGTH_HOTLINK_ID=40 # Hotlink ID length (min 8) # --- Security --- # GOKAPI_MIN_LENGTH_PASSWORD=8 # Minimum password length (min 6) # GOKAPI_DISABLE_API_MENU=false # Hide API menu from non-admin users # GOKAPI_DISABLE_CORS_CHECK=false # Disable CORS check on startup # --- Proxies --- # GOKAPI_TRUSTED_PROXIES=127.0.0.1 # Comma-separated IPs/subnets # GOKAPI_USE_CLOUDFLARE=false # Set true when behind Cloudflare # GOKAPI_DISABLE_DOCKER_TRUSTED_PROXY=false # --- Features --- # GOKAPI_LOG_STDOUT=false # GOKAPI_ENABLE_HOTLINK_VIDEOS=false # GOKAPI_GUEST_UPLOAD_BY_DEFAULT=false # --- File Request limits (non-admin users) --- # GOKAPI_MAX_FILES_GUESTUPLOAD=100 # 0 = unlimited # GOKAPI_MAX_SIZE_GUESTUPLOAD=10240 # MB; 0 = server max # --- Cloud Storage (S3-compatible) --- # GOKAPI_AWS_BUCKET=gokapi # GOKAPI_AWS_REGION=eu-central-1 # GOKAPI_AWS_KEY=keyname123456789 # GOKAPI_AWS_KEY_SECRET=verysecret123 # GOKAPI_AWS_ENDPOINT=s3.eu-central-001.backblazeb2.com # Leave blank for AWS S3 # GOKAPI_AWS_PROXY_DOWNLOAD=false ``` -------------------------------- ### Start Gokapi with Docker Compose Source: https://github.com/forceu/gokapi/blob/master/docs/setup.md Starts the Gokapi service using Docker Compose after downloading the configuration files. The container restarts automatically by default. ```bash docker compose up -d ``` -------------------------------- ### Install Gokapi as a systemd Service Source: https://github.com/forceu/gokapi/blob/master/docs/setup.md Install Gokapi as a systemd service on Linux systems. This command requires sudo privileges. Ensure initial setup is completed manually before installation. The service will run as the user who invoked sudo. ```bash sudo ./gokapi --install-service ``` -------------------------------- ### Build and Test Gokapi from Source Source: https://github.com/forceu/gokapi/blob/master/README.md Clone the repository, build the binary, run tests, and build a local Docker image for development. Ensure you have Go and Docker installed. ```bash # Clone the repository git clone https://github.com/Forceu/gokapi.git cd gokapi # Build the binary make build # Run tests make test # Build Docker image docker build -t gokapi:local . ``` -------------------------------- ### Run Gokapi with Docker Source: https://github.com/forceu/gokapi/blob/master/README.md Instantly start Gokapi using Docker. Mount volumes for data and configuration, map the port, and set the timezone. Visit http://localhost:53842/setup to complete the wizard. ```bash docker run --rm \ --name gokapi \ -v gokapi-data:/app/data \ -v gokapi-config:/app/config \ -p 127.0.0.1:53842:53842 \ -e TZ=UTC \ docker.io/f0rc3/gokapi:latest ``` -------------------------------- ### Gokapi Database Connection Strings Source: https://context7.com/forceu/gokapi/llms.txt Examples of connection strings for SQLite and Redis databases, including options for authentication and SSL with Redis. ```bash sqlite:///app/data/gokapi.sqlite ``` ```bash redis://127.0.0.1:6379 ``` ```bash redis://user:password@127.0.0.1:6379?ssl=true&prefix=gokapi_ ``` ```bash save 1 1 ``` -------------------------------- ### Reconfigure Gokapi Source: https://context7.com/forceu/gokapi/llms.txt Use the `--reconfigure` flag to re-run the setup wizard for both native and Docker deployments. For Docker, ensure volumes are mounted correctly. ```bash # Native ./gokapi --reconfigure # Docker docker run --rm -p 127.0.0.1:53842:53842 \ -v gokapi-data:/app/data \ -v gokapi-config:/app/config \ f0rc3/gokapi:latest /app/run.sh --reconfigure ``` -------------------------------- ### Reconfigure Gokapi (Native) Source: https://github.com/forceu/gokapi/blob/master/docs/setup.md Run Gokapi with the --reconfigure flag to change settings like password, storage, or authentication after initial setup. Access the configuration page using the temporary credentials printed to the console. ```bash ./gokapi --reconfigure ``` -------------------------------- ### Run Gokapi with Docker Source: https://context7.com/forceu/gokapi/llms.txt Use these commands to pull the Gokapi Docker image and run it with persistent volumes for data and configuration. The second example shows how to run as a specific non-root user. ```bash # Pull the stable image docker pull docker.io/f0rc3/gokapi:latest # Start with named volumes (data survives container removal/updates) docker run \ -v gokapi-data:/app/data \ -v gokapi-config:/app/config \ -p 127.0.0.1:53842:53842 \ -e TZ=Europe/Berlin \ f0rc3/gokapi:latest # Run as a specific non-root user docker run --user "1000:1000" \ -v ./gokapi-data:/app/data \ -v ./gokapi-config:/app/config \ -p 127.0.0.1:53842:53842 \ -e TZ=Europe/Berlin \ f0rc3/gokapi:latest ``` -------------------------------- ### Automatic Deployment with Password Source: https://context7.com/forceu/gokapi/llms.txt This command sets the admin password for Gokapi before the first start, ensuring an unattended deployment. ```bash # Set password on the config volume before launching the server docker run --rm \ -v gokapi-data:/app/data \ -v gokapi-config:/app/config \ f0rc3/gokapi:latest \ /app/run.sh --deployment-password "$(openssl rand -base64 24)" ``` -------------------------------- ### Run Gokapi Docker Container (Non-Root User) Source: https://github.com/forceu/gokapi/blob/master/docs/setup.md Run the Gokapi Docker container as a non-root user. This example uses bind mounts, so ensure the host directories exist and have correct permissions. ```bash docker run --user "1000:1000" \ -v ./gokapi-data:/app/data -v ./gokapi-config:/app/config \ -p 127.0.0.1:53842:53842 -e TZ=UTC f0rc3/gokapi:latest ``` -------------------------------- ### Authelia Gokapi Setup Fields Source: https://context7.com/forceu/gokapi/llms.txt Mapping of Authelia identity provider settings to Gokapi's configuration fields for OAuth2/OpenID Connect integration. ```text Provider URL : https://auth.autheliaserver.com Client ID : gokapi Client Secret : AhXeV7_EXAMPLE_KEY Admin email : admin@example.com Scope for groups : groups Authorised groups : admins;dev;gokapi-* ``` -------------------------------- ### Deploy Gokapi with Docker Compose Source: https://context7.com/forceu/gokapi/llms.txt Define your Gokapi service in a docker-compose.yaml file and then start it in detached mode. Ensure your .env file is configured for environment variables. ```yaml # docker-compose.yaml services: gokapi: image: f0rc3/gokapi:latest container_name: gokapi ports: - "127.0.0.1:53842:53842" volumes: - ./gokapi-data:/app/data - ./gokapi-config:/app/config restart: always env_file: - "./.env" ``` ```bash docker compose up -d ``` -------------------------------- ### List Files via API with curl Source: https://github.com/forceu/gokapi/blob/master/docs/advanced.md Authenticate API calls using an API key passed in the `apikey` header. This example retrieves a list of all stored files. ```default curl -X GET "https://your.gokapi.url/api/files/list" -H "accept: application/json" -H "apikey: secret" ``` -------------------------------- ### Custom CSS Example Source: https://context7.com/forceu/gokapi/llms.txt This CSS snippet shows how to add a company banner to all pages by targeting the body element. ```css /* custom/custom.css — example: add a company banner */ body::before { content: "ACME Internal File Share"; display: block; background: #003366; color: #fff; text-align: center; padding: 6px; font-size: 0.85rem; } ``` -------------------------------- ### Migrate Gokapi Database Source: https://github.com/forceu/gokapi/blob/master/docs/advanced.md Use this command to transfer data between databases. Ensure you rerun setup after migration. User sessions are not transferred. ```default gokapi migrate-database --source [old Database URL] --destination [new Database URL] ``` ```default docker run --rm -v gokapi-data:/app/data f0rc3/gokapi:latest /app/run.sh migrate-database --source [old Database URL] --destination [new Database URL] ``` -------------------------------- ### Get Server Version Source: https://context7.com/forceu/gokapi/llms.txt Retrieves the current server version. No API key is required for this endpoint. ```bash curl -s https://your.gokapi.url/api/info/version # Response # { # "Version": "2.2.4", # "VersionInt": 20204, # "EndToEndEncryptionEnabled": false # } ``` -------------------------------- ### Get Server Version Source: https://context7.com/forceu/gokapi/llms.txt Retrieves the current server version. This endpoint does not require an API key. ```APIDOC ## GET /api/info/version — Server version No API key required. ### Description Retrieves the current server version information. ### Method GET ### Endpoint /api/info/version ### Response #### Success Response (200) - **Version** (string) - The server version string. - **VersionInt** (integer) - An integer representation of the version. - **EndToEndEncryptionEnabled** (boolean) - Indicates if end-to-end encryption is enabled. ### Request Example ```bash curl -s https://your.gokapi.url/api/info/version ``` ### Response Example ```json { "Version": "2.2.4", "VersionInt": 20204, "EndToEndEncryptionEnabled": false } ``` ``` -------------------------------- ### Migrate Docker Configuration (Remove and Restart) Source: https://github.com/forceu/gokapi/blob/master/docs/setup.md After copying data, remove the old Gokapi container and start a new one using the `docker run --user` command. This ensures Gokapi runs as the current user, migrating from the deprecated DOCKER_NONROOT variable. Ensure bind-mount directories are owned by the specified user. ```bash # Remove the old container docker rm -f gokapi # Start a new container as the current user docker run --user "$(id -u):$(id -g)" \ -v ./gokapi-data:/app/data -v ./gokapi-config:/app/config \ -p 127.0.0.1:53842:53842 -e TZ=UTC f0rc3/gokapi:latest ``` -------------------------------- ### Set Gokapi Port and Chunk Size via Windows Environment Variables Source: https://github.com/forceu/gokapi/blob/master/docs/advanced.md On Windows, use the 'set' command to define environment variables before running the Gokapi executable. This example sets the port to 12345 and chunk size to 60MB. ```default set GOKAPI_PORT=12345 set GOKAPI_CHUNK_SIZE_MB=60 [...] Gokapi.exe ``` -------------------------------- ### Set Gokapi Port and Chunk Size via Linux/Unix Environment Variables Source: https://github.com/forceu/gokapi/blob/master/docs/advanced.md For native Linux/Unix deployments, set environment variables before executing the Gokapi binary. This example sets the port to 12345 and chunk size to 60MB. ```default GOKAPI_PORT=12345 GOKAPI_CHUNK_SIZE_MB=60 [...] ./Gokapi ``` -------------------------------- ### Get Upload Configuration Source: https://context7.com/forceu/gokapi/llms.txt Retrieves the upload configuration, including maximum file and chunk sizes. Requires `UPLOAD` permission. ```bash curl -s https://your.gokapi.url/api/info/config \ -H "apikey: MY_SECRET_KEY" # Response # { # "MaxFilesize": 100, # "MaxChunksize": 40 # } ``` -------------------------------- ### Authelia OpenID Connect Server Configuration Source: https://github.com/forceu/gokapi/blob/master/docs/examples.md Example Authelia server configuration for OpenID Connect. Ensure `redirect_uris` matches your Gokapi callback URL. Adjust `authorization_policy` and `consent_mode` based on your security and user experience requirements. ```yaml identity_providers: oidc: hmac_secret: noz1Aow6Soo9lieyus2E_EXAMPLE_KEY issuer_private_key: | -----BEGIN PRIVATE KEY----- ohf2shae1bahph7ahSh1 EXAMPLE_KEY EP3EihoPhei9iingai0v== -----END PRIVATE KEY----- access_token_lifespan: 1h authorize_code_lifespan: 1m id_token_lifespan: 1h refresh_token_lifespan: 90m enable_client_debug_messages: false enforce_pkce: public_clients_only cors: endpoints: - authorization - token - revocation - introspection allowed_origins: - "https://*.your.domain" allowed_origins_from_client_redirect_uris: false clients: - id: gokapi-dev description: Gokapi Example secret: 'AhXeV7_EXAMPLE_KEY' sector_identifier: '' public: false authorization_policy: one_factor consent_mode: pre-configured pre_configured_consent_duration: 1w audience: [] scopes: - openid - email - profile - groups redirect_uris: - https://gokapi.website.com/oauth-callback userinfo_signing_algorithm: none ``` -------------------------------- ### GET /api/logs/systemStatus Source: https://context7.com/forceu/gokapi/llms.txt Retrieves system status information, including CPU, memory, disk usage, uptime, and traffic statistics. Requires `MANAGE_LOGS` permission. ```APIDOC ## GET /api/logs/systemStatus ### Description Retrieves system status information. Requires `MANAGE_LOGS` permission. ### Method GET ### Endpoint https://your.gokapi.url/api/logs/systemStatus ### Headers - **apikey** (string) - Required - Your API key. ``` -------------------------------- ### Set Gokapi Port and Chunk Size via Docker Environment Variables Source: https://github.com/forceu/gokapi/blob/master/docs/advanced.md Use the -e argument to pass environment variables when running Gokapi in Docker. This example sets the port to 12345 and chunk size to 60MB. ```default docker run -it -e GOKAPI_PORT=12345 -e GOKAPI_CHUNK_SIZE_MB=60 f0rc3/gokapi:latest ``` -------------------------------- ### Get System Status Source: https://context7.com/forceu/gokapi/llms.txt Retrieves system status information including CPU, memory, disk usage, uptime, and traffic statistics. Requires `MANAGE_LOGS` permission. ```bash curl -s https://your.gokapi.url/api/logs/systemStatus \ -H "apikey: MY_SECRET_KEY" ``` -------------------------------- ### GET /api/uploadrequest/list Source: https://context7.com/forceu/gokapi/llms.txt Lists all file requests. ```APIDOC ## GET /api/uploadrequest/list ### Description Lists all file requests. ### Method GET ### Endpoint https://your.gokapi.url/api/uploadrequest/list ### Headers - **apikey** (string) - Required - Your API key. ``` -------------------------------- ### Build Gokapi from Source (Native Deployment) Source: https://github.com/forceu/gokapi/blob/master/docs/setup.md Clone the repository and build the Gokapi executable locally. Requires Go 1.25 or newer. ```bash git clone https://github.com/Forceu/Gokapi.git . make ``` -------------------------------- ### GET /api/uploadrequest/list/{id} Source: https://context7.com/forceu/gokapi/llms.txt Retrieves details for a single file request. ```APIDOC ## GET /api/uploadrequest/list/{id} ### Description Retrieves details for a single file request. ### Method GET ### Endpoint https://your.gokapi.url/api/uploadrequest/list/{id} ### Path Parameters - **id** (string) - Required - The ID of the file request. ### Headers - **apikey** (string) - Required - Your API key. ``` -------------------------------- ### Run Gokapi Natively Source: https://context7.com/forceu/gokapi/llms.txt Execute the Gokapi binary directly or build it from source. The `--install-service` and `--uninstall-service` flags are for Linux systemd integration. ```bash # Download the appropriate release binary from GitHub and run it ./gokapi # Rebuild from source (requires Go 1.25+) git clone https://github.com/Forceu/Gokapi.git . make # Install as a systemd service (Linux only; run setup first) sudo ./gokapi --install-service sudo ./gokapi --uninstall-service ``` -------------------------------- ### GET /api/logs/get Source: https://context7.com/forceu/gokapi/llms.txt Retrieves log entries. Requires `MANAGE_LOGS` permission. Optionally filter by timestamp. ```APIDOC ## GET /api/logs/get ### Description Retrieves log entries. Requires `MANAGE_LOGS` permission. ### Method GET ### Endpoint https://your.gokapi.url/api/logs/get ### Headers - **apikey** (string) - Required - Your API key. - **timestamp** (integer) - Optional - Unix timestamp to retrieve logs after this time. ``` -------------------------------- ### Initialize Wizard with Options Source: https://github.com/forceu/gokapi/blob/master/internal/configuration/setup/static/setup/src/index.html Initializes a wizard component using jQuery. Ensure the wizard plugin and jQuery are loaded before this script. ```javascript $(function() { var options = {}; var wizard = $("#some-wizard").wizard(options); }); ``` -------------------------------- ### Get Single File Metadata Source: https://context7.com/forceu/gokapi/llms.txt Retrieves metadata for a specific file using its ID. Requires VIEW permission. ```APIDOC ## GET /api/files/list/{id} — Get single file metadata Requires `VIEW` permission. ### Description Retrieves detailed metadata for a specific file identified by its ID. ### Method GET ### Endpoint /api/files/list/{id} ### Path Parameters - **id** (string) - Required - The unique identifier of the file. ### Headers - **apikey** (string) - Required - Your API key. ### Request Example ```bash curl -s https://your.gokapi.url/api/files/list/PFnh2DlQRS2PVKM \ -H "apikey: MY_SECRET_KEY" ``` ``` -------------------------------- ### Get Single File Metadata Source: https://context7.com/forceu/gokapi/llms.txt Retrieves metadata for a single file using its ID. Requires `VIEW` permission. ```bash curl -s https://your.gokapi.url/api/files/list/PFnh2DlQRS2PVKM \ -H "apikey: MY_SECRET_KEY" ``` -------------------------------- ### Build Unstable Version with Git and Make Source: https://github.com/forceu/gokapi/blob/master/docs/update.md For native deployments of the unstable version, pull the latest changes from the Git repository and then build the project using make. Restart Gokapi after the build. ```bash git pull make ``` -------------------------------- ### Get Single File Request Source: https://context7.com/forceu/gokapi/llms.txt Fetches details for a specific file request using its ID. Requires an API key. ```bash curl -s https://your.gokapi.url/api/uploadrequest/list/FILEREQUEST_ID_HERE \ -H "apikey: MY_SECRET_KEY" ``` -------------------------------- ### Get Upload Configuration Source: https://context7.com/forceu/gokapi/llms.txt Retrieves the upload configuration, including maximum file and chunk sizes. Requires UPLOAD permission. ```APIDOC ## GET /api/info/config — Upload configuration Requires `UPLOAD` permission. ### Description Retrieves the server's upload configuration settings. ### Method GET ### Endpoint /api/info/config ### Headers - **apikey** (string) - Required - Your API key. ### Response #### Success Response (200) - **MaxFilesize** (integer) - Maximum allowed file size in MB. - **MaxChunksize** (integer) - Maximum allowed chunk size in MB for chunked uploads. ### Request Example ```bash curl -s https://your.gokapi.url/api/info/config \ -H "apikey: MY_SECRET_KEY" ``` ### Response Example ```json { "MaxFilesize": 100, "MaxChunksize": 40 } ``` ``` -------------------------------- ### Run Gokapi Docker Container (Standard) Source: https://github.com/forceu/gokapi/blob/master/docs/setup.md Standard command to run the Gokapi Docker container. Ensure '/app/data' and '/app/config' are mounted as volumes to persist data. Binds to localhost only by default. ```bash docker run -v gokapi-data:/app/data -v gokapi-config:/app/config \ -p 127.0.0.1:53842:53842 -e TZ=UTC f0rc3/gokapi:latest ``` -------------------------------- ### Temporarily Disable CORS Check Source: https://github.com/forceu/gokapi/blob/master/docs/troubleshooting.md Use GOKAPI_DISABLE_CORS_CHECK=true to bypass CORS checks during setup or testing. This should not be used in production environments. ```bash GOKAPI_DISABLE_CORS_CHECK=true ``` -------------------------------- ### Update Gokapi Natively Source: https://context7.com/forceu/gokapi/llms.txt This sequence downloads the latest Gokapi binary, makes it executable, and then restarts the service. ```bash # Native — replace binary and restart wget https://github.com/Forceu/Gokapi/releases/latest/download/gokapi-linux_amd64 chmod +x gokapi-linux_amd64 && ./gokapi-linux_amd64 ``` -------------------------------- ### Docker Run Command with Custom Assets Source: https://context7.com/forceu/gokapi/llms.txt This command demonstrates how to run a Docker container for Gokapi and mount a local directory for custom assets. ```bash docker run \ -v gokapi-data:/app/data \ -v gokapi-config:/app/config \ -v ./my-custom:/app/custom \ -p 127.0.0.1:53842:53842 \ f0rc3/gokapi:latest ``` -------------------------------- ### Upload a file with custom parameters Source: https://github.com/forceu/gokapi/blob/master/docs/advanced.md Use the `upload` command with flags to specify expiry, download limits, and passwords. Ensure the file path is correctly provided. ```bash gokapi-cli upload -f /path/to/file ``` ```bash gokapi-cli upload -f /tmp/example --expiry-days 10 --password abcd ``` -------------------------------- ### Docker Deployment with Password Source: https://github.com/forceu/gokapi/blob/master/docs/advanced.md Use this command to deploy Gokapi via Docker and set an initial admin password. ```bash docker run --rm -v gokapi-data:/app/data -v gokapi-config:/app/config f0rc3/gokapi:latest /app/run.sh --deployment-password newPassword ``` -------------------------------- ### Pull Latest Gokapi Docker Image Source: https://github.com/forceu/gokapi/blob/master/docs/update.md Use this command to pull the most recent Gokapi Docker image. Ensure you have Docker installed and configured. ```bash docker pull f0rc3/gokapi:latest ``` -------------------------------- ### Create User Source: https://context7.com/forceu/gokapi/llms.txt Creates a new user account. Requires MANAGE_USERS permission. ```bash curl -s -X POST https://your.gokapi.url/api/user/create \ -H "apikey: MY_SECRET_KEY" \ -H "username: alice" ``` -------------------------------- ### Upload a directory with custom parameters Source: https://github.com/forceu/gokapi/blob/master/docs/advanced.md Use the `upload-dir` command with the `-D` flag for the directory path. Customizations like expiry and password can be applied. ```bash gokapi-cli upload-dir -D /tmp/example/ --expiry-days 10 --password abcd ``` -------------------------------- ### Download a File via API Source: https://context7.com/forceu/gokapi/llms.txt Downloads a file using its ID. Can stream the file, get a pre-signed URL, or increment the download counter. Requires DOWNLOAD permission. ```APIDOC ## GET /api/files/download/{id} — Download a file via API Requires `DOWNLOAD` permission. Downloads do not increment the counter by default. Pass `presignUrl: true` to receive a pre-signed S3 URL instead of streaming the file. ### Description Allows downloading a specific file by its ID. Supports different download modes. ### Method GET ### Endpoint /api/files/download/{id} ### Path Parameters - **id** (string) - Required - The unique identifier of the file to download. ### Headers - **apikey** (string) - Required - Your API key. - **presignUrl** (boolean) - Optional - If `true`, returns a pre-signed URL (S3 storage only). - **increaseCounter** (boolean) - Optional - If `true`, increments the download counter. ### Request Example (Stream the file) ```bash curl -s https://your.gokapi.url/api/files/download/PFnh2DlQRS2PVKM \ -H "apikey: MY_SECRET_KEY" \ -o downloaded_report.pdf ``` ### Request Example (Get a pre-signed URL) ```bash curl -s https://your.gokapi.url/api/files/download/PFnh2DlQRS2PVKM \ -H "apikey: MY_SECRET_KEY" \ -H "presignUrl: true" ``` ### Request Example (Increment the download counter) ```bash curl -s https://your.gokapi.url/api/files/download/PFnh2DlQRS2PVKM \ -H "apikey: MY_SECRET_KEY" \ -H "increaseCounter: true" \ -o downloaded_report.pdf ``` ``` -------------------------------- ### Migrate Docker Configuration (Copy Data) Source: https://github.com/forceu/gokapi/blob/master/docs/setup.md Copy existing Gokapi data and configuration from a running container to local directories. These directories must not exist before running these commands. ```bash # Copy data out of the container (directories must not exist yet) docker cp gokapi:/app/config ./gokapi-config docker cp gokapi:/app/data ./gokapi-data ``` -------------------------------- ### CLI Tool Login Source: https://context7.com/forceu/gokapi/llms.txt Initiates an interactive login process for the Gokapi CLI tool, prompting for necessary credentials like URL and API key. ```bash # Interactive login — prompts for URL, API key, and optional E2E key gokapi-cli login ``` -------------------------------- ### Gokapi CLI Login Source: https://github.com/forceu/gokapi/blob/master/docs/advanced.md Authenticate the Gokapi CLI with your server. Credentials are stored in plain text and can be managed via configuration files or Docker volumes. ```bash gokapi-cli login ``` ```bash docker run -it --rm -v gokapi-cli-config:/app/config docker.io/f0rc3/gokapi-cli:latest login ``` -------------------------------- ### Nginx Reverse Proxy Configuration Source: https://context7.com/forceu/gokapi/llms.txt Nginx server block configuration for reverse proxying to Gokapi, including SSL setup, max upload size, and proxy headers. Includes a redirect from HTTP to HTTPS. ```nginx server { listen 80; listen [::]:80; listen 443 ssl; listen [::]:443 ssl; ssl_certificate /your/certificate/fullchain.pem; ssl_certificate_key /your/certificate/privkey.pem; # Must accommodate your largest expected upload client_max_body_size 200M; client_body_buffer_size 128k; server_name your.gokapi.url; proxy_connect_timeout 300; proxy_send_timeout 300; proxy_read_timeout 300; send_timeout 300; location / { # Uncomment the next line ONLY if using Cloudflare # proxy_set_header X-Forwarded-Host $http_cf_connecting_ip; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto http; proxy_pass http://127.0.0.1:53842; } if ($scheme = http) { return 301 https://$server_name$request_uri; } } ``` -------------------------------- ### Create user Source: https://context7.com/forceu/gokapi/llms.txt Creates a new user account in the system. Requires `MANAGE_USERS` permission. ```APIDOC ## POST /api/user/create — Create user Requires `MANAGE_USERS` permission. ### Method POST ### Endpoint https://your.gokapi.url/api/user/create ### Headers - **apikey** (string) - Required - Your API key. - **username** (string) - Required - The username for the new user. ``` -------------------------------- ### Authelia OAuth2/OpenID Connect Configuration Source: https://context7.com/forceu/gokapi/llms.txt Configuration excerpt for Authelia's 'authelia configuration.yml' to set up Gokapi as an OAuth2/OIDC client. Includes client ID, secret, scopes, and redirect URIs. ```yaml # authelia configuration.yml (excerpt) identity_providers: oidc: clients: - id: gokapi secret: 'AhXeV7_EXAMPLE_KEY' authorization_policy: one_factor consent_mode: pre-configured pre_configured_consent_duration: 1w scopes: - openid - email - profile - groups redirect_uris: - https://your.gokapi.url/oauth-callback ``` -------------------------------- ### Gokapi CLI File Download Source: https://context7.com/forceu/gokapi/llms.txt Download files using their ID. Options include saving to a specific path, renaming the output, deleting from the server upon success, and Docker integration. ```bash gokapi-cli download -i PFnh2DlQRS2PVKM ``` ```bash gokapi-cli download \ -i PFnh2DlQRS2PVKM \ --output-path /home/alice/downloads \ --output renamed-report.pdf \ --remove ``` ```bash docker run --rm \ -v gokapi-cli-config:/app/config \ -v /tmp/downloads:/download \ docker.io/f0rc3/gokapi-cli:latest \ download -i PFnh2DlQRS2PVKM -k /download ``` -------------------------------- ### List All Files Source: https://context7.com/forceu/gokapi/llms.txt Lists all files. Requires `VIEW` permission. Add the `showFileRequests: true` header to include files uploaded via File Request links. ```bash curl -s https://your.gokapi.url/api/files/list \ -H "accept: application/json" \ -H "apikey: MY_SECRET_KEY" # With file-request files included curl -s https://your.gokapi.url/api/files/list \ -H "accept: application/json" \ -H "apikey: MY_SECRET_KEY" \ -H "showFileRequests: true" ``` -------------------------------- ### Download Multiple Files as ZIP Source: https://context7.com/forceu/gokapi/llms.txt Downloads multiple files as a ZIP archive. Requires `DOWNLOAD` permission. Pass a comma-separated list of file IDs. ```bash curl -s https://your.gokapi.url/api/files/downloadzip \ -H "apikey: MY_SECRET_KEY" \ -H "ids: PFnh2DlQRS2PVKM,AbCdEfGhIjKlMnO" \ -H "filename: my-archive.zip" \ -o my-archive.zip ``` -------------------------------- ### Google OAuth2/OpenID Connect Configuration Source: https://context7.com/forceu/gokapi/llms.txt Basic configuration details for integrating Google as an OAuth2/OpenID Connect provider with Gokapi. ```text Provider URL : https://accounts.google.com Client ID : XXXXX.apps.googleusercontent.com Redirect URL : https://your.gokapi.url/oauth-callback ``` -------------------------------- ### Reconfigure Gokapi (Docker) Source: https://github.com/forceu/gokapi/blob/master/docs/setup.md Use this command to reconfigure Gokapi when running in a Docker container. Ensure to map necessary volumes for data and configuration persistence. Remember to stop this container and restart your normal Gokapi container afterward. ```bash docker run --rm -p 127.0.0.1:53842:53842 \ -v gokapi-data:/app/data -v gokapi-config:/app/config \ f0rc3/gokapi:latest /app/run.sh --reconfigure ``` -------------------------------- ### Download File via CLI Source: https://github.com/forceu/gokapi/blob/master/docs/advanced.md Use the `download` command with the CLI tool to retrieve files. Files downloaded this way do not increment the download count. ```APIDOC ## Download File via CLI ### Description Use the `download` command with the CLI tool to retrieve files. Files downloaded this way do not increment the download count. ### Command ```bash gokapi-cli download -i [FILE_ID] ``` ### Parameters #### Path Parameters - **-i, --id [id]** (string) - Required - The unique ID of the file. - **-o, --output [string]** (string) - Optional - Renames the file upon download. - **-k, --output-path [path]** (string) - Optional - Target directory (defaults to current folder). - **-r, --remove** (boolean) - Optional - Deletes the file from the server after download. ### Example Download the file with ID `Eukohc6r` to the `/home/user/downloads` folder and delete it from the server after a successful transfer: ```bash gokapi-cli download -i Eukohc6r --output-path /home/user/downloads --remove ``` ``` -------------------------------- ### Enable Cloudflare Compatibility for Uploads Source: https://github.com/forceu/gokapi/blob/master/docs/troubleshooting.md Adjust GOKAPI_CHUNK_SIZE_MB to stay below Cloudflare's free plan upload limit. This prevents uploads larger than ~100 MB from failing. ```bash GOKAPI_CHUNK_SIZE_MB=90 ``` -------------------------------- ### Create API Key Source: https://context7.com/forceu/gokapi/llms.txt Generates a new API key with a specified friendly name. Setting `basicPermissions: true` grants VIEW, UPLOAD, and DOWNLOAD permissions by default. Requires API_MANAGE permission. ```bash curl -s -X POST https://your.gokapi.url/api/auth/create \ -H "apikey: MY_SECRET_KEY" \ -H "friendlyName: CI Upload Bot" \ -H "basicPermissions: true" # Response: { "ApiKey": "newkey30charslongXXXXXXXXXXXXXX", ... } ``` -------------------------------- ### Create API key Source: https://context7.com/forceu/gokapi/llms.txt Generates a new API key. Setting `basicPermissions: true` grants VIEW, UPLOAD, and DOWNLOAD permissions by default. ```APIDOC ## POST /api/auth/create — Create API key Requires `API_MANAGE` permission. `basicPermissions: true` grants VIEW + UPLOAD + DOWNLOAD. ### Method POST ### Endpoint https://your.gokapi.url/api/auth/create ### Headers - **apikey** (string) - Required - Your API key. - **friendlyName** (string) - Optional - A descriptive name for the API key. - **basicPermissions** (boolean) - Optional - If `true`, grants basic permissions (VIEW, UPLOAD, DOWNLOAD). ``` -------------------------------- ### Create File Request Source: https://context7.com/forceu/gokapi/llms.txt Creates a new file request with specified parameters like name, notes, expiry, and maximum files/size. Leave `id` empty for new requests. ```bash # Create a new file request expiring on 2025-12-31 (Unix timestamp) curl -s -X POST https://your.gokapi.url/api/uploadrequest/save \ -H "apikey: MY_SECRET_KEY" \ -H "name: Q4 Project Assets" \ -H "notes: Please upload all final deliverables here." \ -H "expiry: 1767225600" \ -H "maxfiles: 20" \ -H "maxsize: 500" ``` -------------------------------- ### Gokapi CLI Directory Upload Source: https://context7.com/forceu/gokapi/llms.txt Upload a directory, which is compressed into a ZIP file. Docker usage auto-detects directories mounted to /upload/. ```bash gokapi-cli upload-dir -D /path/to/project --expiry-days 10 --password abcd ``` ```bash docker run --rm \ -v gokapi-cli-config:/app/config \ -v /tmp/project/:/upload/ \ docker.io/f0rc3/gokapi-cli:latest upload-dir -n "project-snapshot.zip" ``` -------------------------------- ### Upload a file using Docker Source: https://github.com/forceu/gokapi/blob/master/docs/advanced.md When using Docker, mount the host directory containing the file to the container's upload path. Specify the internal file path with `-f`. If no `-f` is provided and only one file exists in the mounted directory, it will be uploaded. ```docker docker run --rm -v gokapi-cli-config:/app/config -v /tmp/:/upload/ docker.io/f0rc3/gokapi-cli:latest upload -f /upload/example --expiry-downloads 5 ``` ```docker docker run --rm -v gokapi-cli-config:/app/config -v /tmp/single/:/upload/ docker.io/f0rc3/gokapi-cli:latest upload ``` ```docker docker run --rm -v gokapi-cli-config:/app/config -v /tmp/multiple/example:/upload/example docker.io/f0rc3/gokapi-cli:latest upload ``` -------------------------------- ### Gokapi CLI Login and Logout Source: https://context7.com/forceu/gokapi/llms.txt Use 'gokapi-cli login' with a custom config file or for Docker login. 'gokapi-cli logout' is used to end the session. ```bash gokapi-cli login -c /etc/automation/gokapi-cli.json ``` ```bash docker run -it --rm \ -v gokapi-cli-config:/app/config \ docker.io/f0rc3/gokapi-cli:latest login ``` ```bash gokapi-cli logout ``` -------------------------------- ### Retrieve All Log Entries Source: https://context7.com/forceu/gokapi/llms.txt Fetches all available log entries from the system. Requires `MANAGE_LOGS` permission. ```bash # Get all logs curl -s https://your.gokapi.url/api/logs/get \ -H "apikey: MY_SECRET_KEY" ``` -------------------------------- ### List All Files Source: https://context7.com/forceu/gokapi/llms.txt Lists all files. Optionally include files uploaded via File Requests by setting the `showFileRequests` header to `true`. Requires VIEW permission. ```APIDOC ## GET /api/files/list — List all files Requires `VIEW` permission. Add header `showFileRequests: true` to include files uploaded via File Request links. ### Description Retrieves a list of all files managed by Gokapi. ### Method GET ### Endpoint /api/files/list ### Headers - **apikey** (string) - Required - Your API key. - **accept** (string) - Optional - `application/json`. - **showFileRequests** (boolean) - Optional - Set to `true` to include files from File Requests. ### Response #### Success Response (200) - (Array of file objects) - Each object contains metadata about a file. ### Request Example ```bash curl -s https://your.gokapi.url/api/files/list \ -H "accept: application/json" \ -H "apikey: MY_SECRET_KEY" # With file-request files included curl -s https://your.gokapi.url/api/files/list \ -H "accept: application/json" \ -H "apikey: MY_SECRET_KEY" \ -H "showFileRequests: true" ``` ```