Unified CLI

An all-in-one command-line interface built using Koneksi API services.

Releases: https://github.com/koneksi-tech/koneksi-cli/releases

Login and Authentication
  1. You can login or request a token by using this command first, login code will be provided which will be used later on verifying OTP.

koneksi auth login --email "your@email.com" --password "yourpassword"

Example Output (MFA Disabled)

[INFO] Sending login request...
[SUCCESS] Status Code<200>: token requested successfully

=== Authentication Tokens ===
[INFO] Your authentication tokens have been received successfully.
[INFO] Please save these tokens securely for future API requests:
[INFO] ACCESS TOKEN:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2ODUyMjU3NDA0MDkwNDRhNmUyNTEwMTIiLCJlbWFpbCI6ImpiQGFyZGF0YS50ZWNoIiwic2NvcGUiOiJhY2Nlc3MiLCJleHAiOjE3NTAyMzU0MTUsImlhdCI6MTc1MDIzMTgxNX0.YqofqBN0Iy00nUcfiVANM85IdgXLFLGmOKc1aalgf0c

[INFO] REFRESH TOKEN:
eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2ODUyMjU3NDA0MDkwNDRhNmUyNTEwMTIiLCJlbWFpbCI6ImpiQGFyZGF0YS50ZWNoIiwic2NvcGUiOiJyZWZyZXNoIiwiZXhwIjoxNzUwMzE4MjE1LCJpYXQiOjE3NTAyMzE4MTV9.g72yOT3OxqJI_dc6QjCfLvK4vHA1oP0KnEssgVSU04g

[INFO] To use these tokens in API requests, include the access token in your Authorization header:
[INFO] Authorization: Bearer <access-token>

Example Output (MFA Enabled)

[INFO] Sending login request...
[SUCCESS] Status Code<200>: login code requested successfully

=== Multi-Factor Authentication Required ===
[INFO] Your account requires MFA verification. Please follow these steps:

[INFO] 1. Open your authenticator app (Google Authenticator, Authy, etc.)
[INFO] 2. Find the entry for 'Koneksi' and get the current 6-digit code
[INFO] 3. Run the verify command with your login code and OTP:

[INFO] koneksi auth verify-otp --email "jb@ardata.tech" --login-code "65F94D7A58D2" --otp "123456"

[INFO] Replace "123456" with the actual code from your authenticator app

  1. If MFA is enabled you will have to follow up a command like this

koneksi auth verify-otp --email "your@email.com" --login-code "BD51B9CD32DE" --otp "123456"

Example Output

[INFO] Verifying OTP code...
[SUCCESS] Status Code<200>: OTP verified successfully

=== Authentication Tokens ===
[INFO] Your authentication tokens have been received successfully.
[INFO] Please save these tokens securely for future API requests:
[INFO] ACCESS TOKEN:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2ODUyNzRhZDgxNDlkMzQ1MzI2OGFiN2UiLCJzY29wZSI6ImFjY2VzcyIsImV4cCI6MTc1MDIzOTUxOCwiaWF0IjoxNzUwMjM1OTE4fQ.raHBYReFVxvl2v2RnOh3T_m2UyE6uilqZ8ZCWnZitBc

[INFO] REFRESH TOKEN:

eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiI2ODUyNzRhZDgxNDlkMzQ1MzI2OGFiN2UiLCJzY29wZSI6InJlZnJlc2giLCJleHAiOjE3NTAzMjIzMTgsImlhdCI6MTc1MDIzNTkxOH0.m6V3i2FUKDzeshrhQ9CvAN0DFURJCcadO53e6QXFOXM

[INFO] To use these tokens in API requests, include the access token in your Authorization header:
[INFO] Authorization: Bearer <access-token>

  1. If not, you will have your tokens right away, but in this case since MFA is enabled we have to verify with OTP.

  1. Now you can copy and paste your token to use for API Requests.

Multi Factor Authentication
  1. Generate OTP

  • Before you can enable MFA, you have to generate an OTP using this command with your email.

koneksi settings mfa generate-otp --email "your@email.com" --open-browser
  • By enabling --open-browser flag, the CLI will automatically display the QR Code using your default browser.

  • Scan the QR Code using your Authenticator App to register. You will need this later when enabling MFA.

Example Output

[INFO] Generating OTP secret...
[SUCCESS] Status Code<200>: OTP generated successfully


=== MFA Setup Instructions ===
1. Open your authenticator app (Google Authenticator, Authy, etc.)
2. Add a new account by scanning the QR code or entering the secret key manually


--- Secret Key (for manual entry) ---
  <SecretKey>


--- QR Code ---
  URL: <URL>

Opening QR code in your default browser...

3. After adding the account to your authenticator app, verify and enable MFA with:

  koneksi settings mfa enable --email "your@email.com" --otp "<6-digit-code>"

   Replace <6-digit-code> with the code from your authenticator app

IMPORTANT: Keep your secret key safe! If you lose access to your authenticator app,
           you can use this secret key to set up MFA again on a new device.

  1. To enable MFA enter this command with your actual email and verification code (OTP) from your Authenticator App.

koneksi settings mfa enable --email "youur@email.com" --otp "123456"
  1. Great! Now you have MFA enabled, you have to provide the OTP from Authenticator App to be able to login.

Example Output

[INFO] Enabling Multi-Factor Authentication...
[SUCCESS] Status Code<200>: MFA enabled successfully
[INFO] Multi-Factor Authentication has been enabled for your account.


=== Next Steps ===
1. You will now need to provide an OTP code when logging in
2. Your login workflow will now be:

   a. Login with your credentials:
      koneksi auth login --email "your@email.com" --password "your-password"

   b. Verify the OTP from your authenticator app:
      koneksi auth verify-otp --email "your-email" --login-code "CODE_FROM_LOGIN" --otp "CODE_FROM_APP"

3. To disable MFA in the future, use:
   koneksi settings mfa disable --email "jb@ardata.tech" --password "your-password"
File and Directory Management
  1. To create a directory or a folder we use the command:

koneksi directory create --email "your@email.com" --name "Documents"

Optional fields:

  • --directory-id: Parent Directory ID

Example Output

[INFO] Creating directory 'Documents'...
[SUCCESS] Status Code<200>: directory created successfully

Directory Details:
ID:         68527c378149d3453268ab84
Name:       Documents
Created At: 2025-06-18T08:43:35.722084083Z
Size:       0 bytes

  1. To upload a file we use the command:

koneksi file upload --email "your@email.com" --file-path "C:\Users\user\Downloads\TestImage.jpg"

Example Output

[INFO] Uploading file 'TestImage.jpg' (2001760 bytes) to directory ...
[SUCCESS] Status Code<200>: file uploaded successfully

File Information:
Name:         TestImage.jpg
Size:         2001760 bytes
Content Type: application/octet-stream
Directory ID: 685274ad8149d3453268ab83
Hash:         bafybeigrit7bingonpbvhzgcoo5p7einobcs2a6jk76drwymih6n7ked74
  1. To make sure our file was uploaded, we can check it in it's parent directory using this command:

koneksi directory read --email "your@email.com" --directory-id "685274ad8149d3453268ab83"

Optional fields:

  • --directory-id: Directory ID to read, if not provided root directory will be read.

Example Output

[INFO] Reading directory...
[SUCCESS] Status Code<200>: directory read successfully

Directory Information:
ID:         685274ad8149d3453268ab83
Name:       root
Created:    2025-06-18 08:11:25
Updated:    2025-06-18 08:53:48
Size:       2001760 bytes

Subdirectories:
- ID: 68527c378149d3453268ab84 | Name: Documents | Created At: 2025-06-18 08:43:35 | Size: 0 bytes

Files:
- ID: 68527e9c8149d3453268ab85 | Name: TestImage.jpg | Created At: 2025-06-18 08:53:48 | Size: 2001760 bytes
  1. We can also read the file by using this command:

koneksi file read --email "your@email.com" --file-id "68527e9c8149d3453268ab85"

Example Output

[INFO] Reading file with ID '68527e9c8149d3453268ab85'...
[SUCCESS] Status Code<200>: file read successfully

File Information:
ID:           68527e9c8149d3453268ab85
Name:         TestImage.jpg
Size:         2001760 bytes
Content Type: application/octet-stream
Directory ID: 685274ad8149d3453268ab83
Hash:         bafybeigrit7bingonpbvhzgcoo5p7einobcs2a6jk76drwymih6n7ked74
Is Shared:    false
Created At:   2025-06-18T08:53:48.887Z
Updated At:   2025-06-18T08:53:48.887Z

For more Directory and File commands you can always use the koneksi help directory and koneksi help file

API Key Management

Generate

  1. To generate your API Key you have to use this command

koneksi service-account generate --name "my-service" --email "your@email.com"

Note: If there's an error saying about an invalid token, that means you haven't able to login yet. Remember that you can login using the koneksi auth login -h

[INFO] Generating API keys ...
[SUCCESS] Status Code<200>: API keys generation successful
[INFO] API Key for your service account has been generated.
Service Account Credentials
Client ID:     <ClientKey>
Client Secret: <SecretKey>
[WARNING] Note: Client Secret is shown only once upon generation. If lost, a new key must be generated.

  1. You now have your API Key, make sure to save your Client Secret somewhere safe as it would be only shown once.

Browse

  1. To browse or view all your API Keys you can use the command

koneksi service-account browse --email "your@email.com"
  1. It will show a table list of all your generated API Keys with their Name, Client ID and creation date.

[INFO] Retrieving service accounts...
[SUCCESS] Status Code<200>: Retrieved service accounts successfully

Found 1 service account(s):

┌────────────┬───────────────────────────────────────────────┬─────────────────────┐
│    NAME    │                   CLIENT ID                   │     CREATED AT      │
├────────────┼───────────────────────────────────────────────┼─────────────────────┤
│ my-service │                  <ClientKey>                  │ 2025-06-18 09:15:17 │
└────────────┴───────────────────────────────────────────────┴─────────────────────┘

Revoke

  1. To revoke an API Key means to delete it, to do so you can use the command

koneksi service-account revoke --email "your@email.com" --client-id "<ClientKey>"

Optional fields:

  • --yes: Skip confirmation prompt

Are you sure you want to revoke the service account with client ID '<ClientKey>'? (y/N): y
[INFO] Revoking service account with client ID '<ClientKey>'...
[SUCCESS] Status Code<200>: service account revoked successfully

You have to enter y to confirm the deletion. If you want to disable delete confirmation you can use the flag -y or --yes

Last updated