# 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"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.4mica.xyz/api-reference/4mica-services-json-rpc-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
