/api/coins/import

GET

Imports CloudCoin files from the Import folder into the active wallet's Bank folder.

Description

The `/api/coins/import` endpoint is the simple way to import coins. It automatically scans the active wallet's Import folder for CloudCoin files (.bin, .stack, .jpeg, .jpg, .png formats), authenticates them with the RAIDA network, and moves authenticated coins to the Bank folder. Fracked coins are moved to the Fracked folder, and counterfeit coins are moved to the Counterfeit folder.

💡 Simple Import Workflow

Step 1: Place CloudCoin files in [wallet]/Import/
Step 2: Call this endpoint (no parameters needed)
Step 3: All files are automatically processed

🔄 Need More Control?

For importing specific files from absolute paths with transaction memos and async task tracking, use /api/transactions/import instead.

📁 File Locations

Import from: [wallet]/Import/
Authenticated coins to: [wallet]/Bank/
Fracked coins to: [wallet]/Fracked/
Counterfeit coins to: [wallet]/Counterfeit/

Parameters

This endpoint does not require any parameters. It automatically processes all files in the active wallet's Import folder.

Response

Returns a JSON object with the operation status and details about the import operation.

Response Properties

status string
Always "success" if the request was processed.
operation string
The operation type - "coins-import".
message string
A human-readable message describing the result.
wallet string
The name of the active wallet where coins were imported.

Example Response (Success)

{
  "status": "success",
  "operation": "coins-import",
  "message": "Import operation completed successfully",
  "wallet": "Default"
}

Example Error Response (No Wallet)

{
  "error": "No active wallet"
}

Examples

JavaScript (fetch)

const API_HOST = 'http://localhost:8080';

async function importCoins() {
    try {
        const response = await fetch(`${API_HOST}/api/coins/import`);
        const result = await response.json();

        if (result.status === 'success') {
            console.log('Import successful!');
            console.log(`Wallet: ${result.wallet}`);
            console.log(`Message: ${result.message}`);
        } else {
            console.error('Import failed:', result.error);
        }
    } catch (error) {
        console.error('Error importing coins:', error);
    }
}

importCoins();

cURL

# Import coins from Import folder
curl -X GET "http://localhost:8080/api/coins/import"

Go

package main

import (
    "encoding/json"
    "fmt"
    "io/ioutil"
    "net/http"
)

const ApiHost = "http://localhost:8080"

type ImportResponse struct {
    Status    string `json:"status"`
    Operation string `json:"operation"`
    Message   string `json:"message"`
    Wallet    string `json:"wallet"`
}

func main() {
    resp, err := http.Get(fmt.Sprintf("%s/api/coins/import", ApiHost))
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    body, _ := ioutil.ReadAll(resp.Body)

    var result ImportResponse
    if err := json.Unmarshal(body, &result); err != nil {
        panic(err)
    }

    fmt.Printf("Import Status: %s\n", result.Status)
    fmt.Printf("Wallet: %s\n", result.Wallet)
    fmt.Printf("Message: %s\n", result.Message)
}

Related Endpoints

/api/transactions/import

More advanced alternative - import specific files from absolute paths with a transaction memo and async task tracking.

/api/wallet/balance

After importing coins, check your wallet's balance to see the total value of authenticated coins.

/api/wallet/list

View all configured wallets and their locations on the system.