Encode List - fennelLabs/fennel-service-api GitHub Wiki

WhiteFlag Encode List

POST /v1/whiteflag/encode_list/

Encodes multiple WhiteFlag protocol messages in a batch operation. This endpoint takes an array of WhiteFlag message structures and encodes each one, with optional encryption for private communications between API groups.

Authentication

This endpoint requires authentication. Include your token in the Authorization header:

Authorization: Token your_auth_token_here

Request Body

{
  "signals": [
    {
      "prefix": "WF",
      "version": "1",
      "encryptionIndicator": "0",
      "duressIndicator": "0",
      "messageCode": "T",
      "referenceIndicator": "0",
      "referencedMessage": "0000000000000000000000000000000000000000000000000000000000000000"
    },
    {
      "prefix": "WF",
      "version": "1",
      "encryptionIndicator": "0",
      "duressIndicator": "0",
      "messageCode": "A",
      "referenceIndicator": "0",
      "referencedMessage": "0000000000000000000000000000000000000000000000000000000000000000",
      "verificationMethod": "1",
      "verificationData": "https://example.org/auth"
    }
  ],
  "recipient_group": "string"
}

Parameters

  • signals (array, required): Array of WhiteFlag message objects to encode
  • recipient_group (string, optional): API group name for encrypted private messaging

Response

Success Response (200 OK)

[
  {
    "signal": "574631000000000000000000000000000000000000000000000000000000000000000000",
    "success": true,
    "message": "signal encoded"
  },
  {
    "signal": "574631000041000000000000000000000000000000000000000000000000000000000000",
    "success": true,
    "message": "signal encoded"
  }
]

Error Response (400 Bad Request)

{
  "signals": ["This field is required."]
}

Example Usage

# Encode multiple WhiteFlag messages
curl -X POST https://fennel.network/api/v1/whiteflag/encode_list/ \
  -H "Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b" \
  -H "Content-Type: application/json" \
  -d '{
    "signals": [
      {
        "prefix": "WF",
        "version": "1",
        "encryptionIndicator": "0",
        "duressIndicator": "0",
        "messageCode": "T",
        "referenceIndicator": "0",
        "referencedMessage": "0000000000000000000000000000000000000000000000000000000000000000"
      },
      {
        "prefix": "WF",
        "version": "1",
        "encryptionIndicator": "0",
        "duressIndicator": "0",
        "messageCode": "E",
        "referenceIndicator": "0",
        "referencedMessage": "0000000000000000000000000000000000000000000000000000000000000000",
        "subjectCode": "52",
        "datetime": "2025-09-26T12:00:00Z",
        "duration": "P1D",
        "objectType": "01",
        "objectLatitude": "+40.7128",
        "objectLongitude": "-074.0060"
      }
    ]
  }'

# Encode with encryption for private group
curl -X POST https://fennel.network/api/v1/whiteflag/encode_list/ \
  -H "Authorization: Token 9944b09199c62bcf9418ad846dd0e4bbdfc6ee4b" \
  -H "Content-Type: application/json" \
  -d '{
    "signals": [
      {
        "prefix": "WF",
        "version": "1",
        "encryptionIndicator": "1",
        "duressIndicator": "0",
        "messageCode": "M",
        "referenceIndicator": "0",
        "referencedMessage": "0000000000000000000000000000000000000000000000000000000000000000",
        "subjectCode": "10",
        "datetime": "2025-09-26T12:00:00Z"
      }
    ],
    "recipient_group": "humanitarian_org"
  }'

Response Structure

Each encoded signal in the response contains:

  • signal: Hexadecimal encoded WhiteFlag message
  • success: Boolean indicating if encoding was successful
  • message: Status message describing the result

Input Formats

The endpoint accepts signals in two formats:

JSON Objects (Recommended)

{
  "prefix": "WF",
  "version": "1",
  "messageCode": "T"
}

String Format (Legacy)

"{'prefix': 'WF', 'version': '1', 'messageCode': 'T'}"

Encryption Support

When recipient_group is specified:

  • Messages with encryptionIndicator: "1" are encrypted for the recipient group
  • Sender must be a member of an API group for encryption to work
  • Recipient group must exist in the system
  • Encrypted messages can only be decoded by the recipient group

Use Cases

Bulk Message Preparation

  • Encode multiple messages for batch transmission
  • Prepare message queues for blockchain sending
  • Pre-process WhiteFlag communications

Mixed Message Types

  • Encode different message types in one request
  • Handle authentication + operational messages together
  • Process emergency and status updates simultaneously

Private Group Communications

  • Encrypt sensitive humanitarian communications
  • Secure operational coordination messages
  • Protect confidential emergency response data

Notes

  • All messages are processed independently - one failure doesn't stop others
  • Requires authentication to access user's API group for encryption
  • Mixed encrypted/unencrypted messages are supported in the same batch
  • Invalid message structures return success: false with error details
  • This endpoint requires the WhiteFlag CLI service to be operational
  • Large batches may take longer to process due to individual encoding operations
  • Encrypted messages require proper API group membership and permissions
⚠️ **GitHub.com Fallback** ⚠️