Skip to content
Protocol primitive

Protobuf encode

Encode numbered field maps into raw protobuf hex and base64 wire frames.

POSTapi.tikultra.com/v1/crypto/protobuf/encodePrimitive · 2 credits
Upstreamlocal · protobuf encoderEvery plan

Parameters

NameTypeDescription
fieldsrequiredobjectMap of protobuf field numbers to integers, UTF-8 strings, hex bytes or nested objects.
e.g. {"1":12,"2":"test"}

Pricing

PlanPer callPer 1,000 calls
Starter2 credits$0.23
Growth2 credits$0.16
Scale2 credits$0.12

Response fields

FieldTypeDescription
byte_lengthintegerDecoded byte length value.
hexstringDecoded hex value.
base64stringDecoded base64 value.
field_countintegerTotal field count.

Responses

A 200 returns JSON with stable field names. Every response carries x-credits-cost, x-credits-tier and x-credits-remaining. Errors return a JSON body with a stable code and cost 0 credits. Error codes

import os
from tikultra import TikUltra

with TikUltra(api_key=os.environ["TIKULTRA_KEY"]) as client:
    res = client.crypto.protobuf_encode({
        "1": 12,
        "2": "test",
        "3": {
            "1": 1233,
            "2": "musical_ly",
        },
    })
    print(res.credits_cost, res.data)
{
  "byte_length": 24,
  "hex": "080c1204746573741a0e08d109120a6d75736963616c5f6c79",
  "base64": "CAwSBHRlc3QaDgjRCxIKbXVzaWNhbF9seQ==",
  "field_count": 3
}
Try it in the playgroundFull reference in the docs

More in Devices, signing & primitives

Ready to build?

Start with 2,500 free credits and test every public endpoint, then pick a plan.