Metafile Index Service

logo

API

Endpoint https://metafile.id

Server Info

GET /info

Query File

GET /v1/files/<file_id>

GET /v1/files/query?sha256=<sha256>&metaid=<metaid>

Query Chunk

GET /v1/chunks/<file_id>/<chunk_sequence>

GET /v1/chunks/query?sha256=<sha256>

Create File

POST /v1/files

KeysTypeDescription
sizeintFile size in bytes
sha256stringFile SHA-256 hash
metaidstringUser MetaID
namestringFile name
data_typestringFile MIME
KeysTypeDescription
codeintResponse code
messagestringServer message
file_idstringServer unique ID for this file
chunksintHow many chunks should this file be separated into
chunk_sizeintChunk max length in bytes

Update Chunk

POST /v1/chunks

sizeintFile size in bytes
file_idstringFile unique ID
chunk_sequenceintSequence number of the chunk, 0 means update file index or metafile in legacy format
sha256stringSHA-256 hash of the chunk or the file index
txidstringmetafile/chunk transaction if chunk_sequence = 1, 2, 3...
metafile/index or legacy metafile transaction if chunk_sequence = 0
KeysTypeDescription
codeintResponse code
messagestringServer message
txidstringThe txid to index this chunk (chunk_sequence = 1, 2, 3...) or the file (chunk_sequence = 0)

Response Code

Response CodeDescription
0OK
10Unknown exception
20Bad request, parameter type mismatch or missing required fields
30File not found
31The file has finished upload before and cannot be modified
32Invalid chunk sequence
33Chunk not found
34File hash mismatch
35Chunk hash mismatch
36Bad transaction
37Bad chunk index payload

Download File

https://metafile.id/download/<txid>

Service Fee

The query service is currently FREE, but there is a charge for creating a new index.

When requesting Update Chunk API to log your file, we require every metafile/chunk and metafile/index transaction has a P2PKH service fee output.

Let's say, the size of all the OP_RETURN pushdata is S bytes (only the data, excluding OP_CODES), then you need to pay at least

satoshis to our service_fee_address. The value of service fee parameters can be found here.

Example, if service_fee_min_satoshis is 996 and service_fee_rate is 0.025.

For transaction 098c51291fcd3f070ca19487dd19ae3e3842d3d7376d936ed5e6af0ba4c4d2d6, the size of all the OP_RETURN pushdata is 44073 bytes, then the service fee would be

For transaction 1bfb803342f1958612b943aa599667339a12b61fbffb95d17770493e458b212d, the size of all the OP_RETURN pushdata is 728 bytes, then the service fee would be

Client Flow

Example 1

File pxtYFBwYYH.txt has 102402 bytes, the chunk size is 102400 bytes, so separate it into 2 chunks.

Then there are 3 transactions associated with this file.

Query response of this file:

Example 2

File vobeLfOHBx.txt has 512 bytes which is less than the chunk size, so no need to separate, use legacy metafile format.

Then there is only 1 transaction associated with this file.

Query response of this file:

SDK

Python >= 3.6

Contact

Join our Telegram group or email [email protected] 🚀