> For the complete documentation index, see [llms.txt](https://docs.4mica.xyz/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.4mica.xyz/api-reference/4mica-services-json-rpc-api.md).

# 4mica Services JSON-RPC API

## POST /core/getPublicParams

> Get public parameters (BLS public key)

```json
{"openapi":"3.0.3","info":{"title":"4mica Services JSON-RPC API","version":"0.1.0-prealpha"},"servers":[{"url":"https://develop.4mica.xyz"}],"paths":{"/core/getPublicParams":{"post":{"summary":"Get public parameters (BLS public key)","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonRpcRequest"}}}},"responses":{"200":{"description":"Core public parameters","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonRpcResponse_CorePublicParameters"}}}}}}}},"components":{"schemas":{"JsonRpcRequest":{"type":"object","properties":{"jsonrpc":{"type":"string","enum":["2.0"]},"method":{"type":"string"},"params":{"type":"array"},"id":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"required":["jsonrpc","method","id"]},"JsonRpcResponse_CorePublicParameters":{"type":"object","properties":{"jsonrpc":{"type":"string"},"id":{"oneOf":[{"type":"string"},{"type":"integer"}]},"result":{"$ref":"#/components/schemas/CorePublicParameters"},"error":{"$ref":"#/components/schemas/JsonRpcError"}}},"CorePublicParameters":{"type":"object","properties":{"public_key":{"type":"array","items":{"type":"integer"}}}},"JsonRpcError":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"},"data":{"type":"string"}},"required":["code","message"]}}}}
```

## POST /core/registerUser

> Register a new user address

```json
{"openapi":"3.0.3","info":{"title":"4mica Services JSON-RPC API","version":"0.1.0-prealpha"},"servers":[{"url":"https://develop.4mica.xyz"}],"paths":{"/core/registerUser":{"post":{"summary":"Register a new user address","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonRpcRequest"}}}},"responses":{"200":{"description":"Success or error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonRpcResponse_Null"}}}}}}}},"components":{"schemas":{"JsonRpcRequest":{"type":"object","properties":{"jsonrpc":{"type":"string","enum":["2.0"]},"method":{"type":"string"},"params":{"type":"array"},"id":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"required":["jsonrpc","method","id"]},"JsonRpcResponse_Null":{"type":"object","properties":{"jsonrpc":{"type":"string"},"id":{"oneOf":[{"type":"string"},{"type":"integer"}]},"result":{"type":"null"},"error":{"$ref":"#/components/schemas/JsonRpcError"}}},"JsonRpcError":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"},"data":{"type":"string"}},"required":["code","message"]}}}}
```

## POST /core/getUser

> Retrieve deposit info for a user

```json
{"openapi":"3.0.3","info":{"title":"4mica Services JSON-RPC API","version":"0.1.0-prealpha"},"servers":[{"url":"https://develop.4mica.xyz"}],"paths":{"/core/getUser":{"post":{"summary":"Retrieve deposit info for a user","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonRpcRequest"}}}},"responses":{"200":{"description":"User info or null if not found","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonRpcResponse_UserInfo"}}}}}}}},"components":{"schemas":{"JsonRpcRequest":{"type":"object","properties":{"jsonrpc":{"type":"string","enum":["2.0"]},"method":{"type":"string"},"params":{"type":"array"},"id":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"required":["jsonrpc","method","id"]},"JsonRpcResponse_UserInfo":{"type":"object","properties":{"jsonrpc":{"type":"string"},"id":{"oneOf":[{"type":"string"},{"type":"integer"}]},"result":{"oneOf":[{"$ref":"#/components/schemas/UserInfo"},{"type":"null"}]},"error":{"$ref":"#/components/schemas/JsonRpcError"}}},"UserInfo":{"type":"object","properties":{"deposit":{"type":"number"},"available_deposit":{"type":"number"},"transactions":{"type":"array","items":{"$ref":"#/components/schemas/UserTransactionInfo"}}}},"UserTransactionInfo":{"type":"object","properties":{"user_addr":{"type":"string"},"recipient_addr":{"type":"string"},"tx_hash":{"type":"string"},"amount":{"type":"number"},"verified":{"type":"boolean"},"finalized":{"type":"boolean"},"failed":{"type":"boolean"},"cert":{"type":"string","nullable":true},"created_at":{"type":"integer"}}},"JsonRpcError":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"},"data":{"type":"string"}},"required":["code","message"]}}}}
```

## POST /core/issuePaymentCert

> Lock deposit and return a BLS payment certificate

```json
{"openapi":"3.0.3","info":{"title":"4mica Services JSON-RPC API","version":"0.1.0-prealpha"},"servers":[{"url":"https://develop.4mica.xyz"}],"paths":{"/core/issuePaymentCert":{"post":{"summary":"Lock deposit and return a BLS payment certificate","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonRpcRequest"}}}},"responses":{"200":{"description":"Payment certificate","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonRpcResponse_PaymentCertificate"}}}}}}}},"components":{"schemas":{"JsonRpcRequest":{"type":"object","properties":{"jsonrpc":{"type":"string","enum":["2.0"]},"method":{"type":"string"},"params":{"type":"array"},"id":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"required":["jsonrpc","method","id"]},"JsonRpcResponse_PaymentCertificate":{"type":"object","properties":{"jsonrpc":{"type":"string"},"id":{"oneOf":[{"type":"string"},{"type":"integer"}]},"result":{"$ref":"#/components/schemas/PaymentCertificate"},"error":{"$ref":"#/components/schemas/JsonRpcError"}}},"PaymentCertificate":{"type":"object","properties":{"claims":{"type":"string","description":"Hex-encoded JSON claims"},"signature":{"type":"string","description":"Hex-encoded BLS signature"}},"required":["claims","signature"]},"JsonRpcError":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"},"data":{"type":"string"}},"required":["code","message"]}}}}
```

## POST /core/getTransactionsByHash

> Retrieve transactions by their hashes

```json
{"openapi":"3.0.3","info":{"title":"4mica Services JSON-RPC API","version":"0.1.0-prealpha"},"servers":[{"url":"https://develop.4mica.xyz"}],"paths":{"/core/getTransactionsByHash":{"post":{"summary":"Retrieve transactions by their hashes","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonRpcRequest"}}}},"responses":{"200":{"description":"List of transactions","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonRpcResponse_ArrayOfUserTransactionInfo"}}}}}}}},"components":{"schemas":{"JsonRpcRequest":{"type":"object","properties":{"jsonrpc":{"type":"string","enum":["2.0"]},"method":{"type":"string"},"params":{"type":"array"},"id":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"required":["jsonrpc","method","id"]},"JsonRpcResponse_ArrayOfUserTransactionInfo":{"type":"object","properties":{"jsonrpc":{"type":"string"},"id":{"oneOf":[{"type":"string"},{"type":"integer"}]},"result":{"type":"array","items":{"$ref":"#/components/schemas/UserTransactionInfo"}},"error":{"$ref":"#/components/schemas/JsonRpcError"}}},"UserTransactionInfo":{"type":"object","properties":{"user_addr":{"type":"string"},"recipient_addr":{"type":"string"},"tx_hash":{"type":"string"},"amount":{"type":"number"},"verified":{"type":"boolean"},"finalized":{"type":"boolean"},"failed":{"type":"boolean"},"cert":{"type":"string","nullable":true},"created_at":{"type":"integer"}}},"JsonRpcError":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"},"data":{"type":"string"}},"required":["code","message"]}}}}
```

## POST /core/verifyTransaction

> Verify a transaction by hash

```json
{"openapi":"3.0.3","info":{"title":"4mica Services JSON-RPC API","version":"0.1.0-prealpha"},"servers":[{"url":"https://develop.4mica.xyz"}],"paths":{"/core/verifyTransaction":{"post":{"summary":"Verify a transaction by hash","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonRpcRequest"}}}},"responses":{"200":{"description":"Verification result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonRpcResponse_TransactionVerificationResult"}}}}}}}},"components":{"schemas":{"JsonRpcRequest":{"type":"object","properties":{"jsonrpc":{"type":"string","enum":["2.0"]},"method":{"type":"string"},"params":{"type":"array"},"id":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"required":["jsonrpc","method","id"]},"JsonRpcResponse_TransactionVerificationResult":{"type":"object","properties":{"jsonrpc":{"type":"string"},"id":{"oneOf":[{"type":"string"},{"type":"integer"}]},"result":{"$ref":"#/components/schemas/TransactionVerificationResult"},"error":{"$ref":"#/components/schemas/JsonRpcError"}}},"TransactionVerificationResult":{"type":"string","enum":["Verified","AlreadyVerified","NotFound"]},"JsonRpcError":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"},"data":{"type":"string"}},"required":["code","message"]}}}}
```

## POST /recipient/verifyPaymentGuarantee

> Verify a payment certificate

```json
{"openapi":"3.0.3","info":{"title":"4mica Services JSON-RPC API","version":"0.1.0-prealpha"},"servers":[{"url":"https://develop.4mica.xyz"}],"paths":{"/recipient/verifyPaymentGuarantee":{"post":{"summary":"Verify a payment certificate","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonRpcRequest"}}}},"responses":{"200":{"description":"Verification result","content":{"application/json":{"schema":{"$ref":"#/components/schemas/JsonRpcResponse_PaymentVerificationResult"}}}}}}}},"components":{"schemas":{"JsonRpcRequest":{"type":"object","properties":{"jsonrpc":{"type":"string","enum":["2.0"]},"method":{"type":"string"},"params":{"type":"array"},"id":{"oneOf":[{"type":"string"},{"type":"integer"}]}},"required":["jsonrpc","method","id"]},"JsonRpcResponse_PaymentVerificationResult":{"type":"object","properties":{"jsonrpc":{"type":"string"},"id":{"oneOf":[{"type":"string"},{"type":"integer"}]},"result":{"$ref":"#/components/schemas/PaymentVerificationResult"},"error":{"$ref":"#/components/schemas/JsonRpcError"}}},"PaymentVerificationResult":{"type":"object","oneOf":[{"type":"object","properties":{"result":{"type":"string","enum":["Verified"]},"claims":{"$ref":"#/components/schemas/PaymentCertificate"}}},{"type":"object","properties":{"result":{"type":"string","enum":["AlreadyVerified"]},"claims":{"$ref":"#/components/schemas/PaymentCertificate"}}},{"type":"object","properties":{"result":{"type":"string","enum":["InvalidCertificate"]}}}]},"PaymentCertificate":{"type":"object","properties":{"claims":{"type":"string","description":"Hex-encoded JSON claims"},"signature":{"type":"string","description":"Hex-encoded BLS signature"}},"required":["claims","signature"]},"JsonRpcError":{"type":"object","properties":{"code":{"type":"integer"},"message":{"type":"string"},"data":{"type":"string"}},"required":["code","message"]}}}}
```
