{
  "swagger": "2.0",
  "info": {
    "title": "xmtpv4/message_api/message_api.proto",
    "version": "version not set"
  },
  "tags": [
    {
      "name": "ReplicationApi"
    }
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/mls/v2/get-inbox-ids": {
      "post": {
        "operationId": "ReplicationApi_GetInboxIds",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/xmtpv4message_apiGetInboxIdsResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/rpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/xmtpv4message_apiGetInboxIdsRequest"
            }
          }
        ],
        "tags": [
          "ReplicationApi"
        ]
      }
    },
    "/mls/v2/get-newest-envelope": {
      "post": {
        "summary": "Get the newest envelope for each topic",
        "operationId": "ReplicationApi_GetNewestEnvelope",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/message_apiGetNewestEnvelopeResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/rpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/message_apiGetNewestEnvelopeRequest"
            }
          }
        ],
        "tags": [
          "ReplicationApi"
        ]
      }
    },
    "/mls/v2/publish-payer-envelopes": {
      "post": {
        "operationId": "ReplicationApi_PublishPayerEnvelopes",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/message_apiPublishPayerEnvelopesResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/rpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/message_apiPublishPayerEnvelopesRequest"
            }
          }
        ],
        "tags": [
          "ReplicationApi"
        ]
      }
    },
    "/mls/v2/query-envelopes": {
      "post": {
        "operationId": "ReplicationApi_QueryEnvelopes",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/message_apiQueryEnvelopesResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/rpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/message_apiQueryEnvelopesRequest"
            }
          }
        ],
        "tags": [
          "ReplicationApi"
        ]
      }
    },
    "/mls/v2/subscribe-envelopes": {
      "post": {
        "operationId": "ReplicationApi_SubscribeEnvelopes",
        "responses": {
          "200": {
            "description": "A successful response.(streaming responses)",
            "schema": {
              "type": "object",
              "properties": {
                "result": {
                  "$ref": "#/definitions/message_apiSubscribeEnvelopesResponse"
                },
                "error": {
                  "$ref": "#/definitions/rpcStatus"
                }
              },
              "title": "Stream result of message_apiSubscribeEnvelopesResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/rpcStatus"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/message_apiSubscribeEnvelopesRequest"
            }
          }
        ],
        "tags": [
          "ReplicationApi"
        ]
      }
    }
  },
  "definitions": {
    "associationsIdentifierKind": {
      "type": "string",
      "enum": [
        "IDENTIFIER_KIND_UNSPECIFIED",
        "IDENTIFIER_KIND_ETHEREUM",
        "IDENTIFIER_KIND_PASSKEY"
      ],
      "default": "IDENTIFIER_KIND_UNSPECIFIED",
      "description": "- IDENTIFIER_KIND_UNSPECIFIED: Ethereum on old clients",
      "title": "List of identity kinds"
    },
    "associationsRecoverableEcdsaSignature": {
      "type": "object",
      "properties": {
        "bytes": {
          "type": "string",
          "format": "byte",
          "title": "65-bytes [ R || S || V ], with recovery id as the last byte"
        }
      },
      "title": "RecoverableEcdsaSignature for EIP-191 and V2 signatures"
    },
    "envelopesBlockchainProof": {
      "type": "object",
      "properties": {
        "transactionHash": {
          "type": "string",
          "format": "byte"
        }
      },
      "title": "An alternative to a signature for blockchain payloads"
    },
    "envelopesOriginatorEnvelope": {
      "type": "object",
      "properties": {
        "unsignedOriginatorEnvelope": {
          "type": "string",
          "format": "byte",
          "title": "Protobuf serialized"
        },
        "originatorSignature": {
          "$ref": "#/definitions/associationsRecoverableEcdsaSignature"
        },
        "blockchainProof": {
          "$ref": "#/definitions/envelopesBlockchainProof"
        }
      },
      "title": "Signed originator envelope"
    },
    "envelopesPayerEnvelope": {
      "type": "object",
      "properties": {
        "unsignedClientEnvelope": {
          "type": "string",
          "format": "byte",
          "title": "Protobuf serialized"
        },
        "payerSignature": {
          "$ref": "#/definitions/associationsRecoverableEcdsaSignature"
        },
        "targetOriginator": {
          "type": "integer",
          "format": "int64"
        },
        "messageRetentionDays": {
          "type": "integer",
          "format": "int64"
        }
      },
      "title": "Wraps client envelope with payer signature"
    },
    "message_apiEnvelopesQuery": {
      "type": "object",
      "properties": {
        "topics": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "byte"
          },
          "title": "Client queries"
        },
        "originatorNodeIds": {
          "type": "array",
          "items": {
            "type": "integer",
            "format": "int64"
          },
          "title": "Node queries"
        },
        "lastSeen": {
          "$ref": "#/definitions/xmtpv4envelopesCursor"
        }
      },
      "title": "Query for envelopes, shared by query and subscribe endpoints\nEither topics or originator_node_ids may be set, but not both"
    },
    "message_apiGetNewestEnvelopeRequest": {
      "type": "object",
      "properties": {
        "topics": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "byte"
          }
        }
      },
      "title": "Request to get the newest envelope for a given topic"
    },
    "message_apiGetNewestEnvelopeResponse": {
      "type": "object",
      "properties": {
        "results": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/message_apiGetNewestEnvelopeResponseResponse"
          },
          "title": "The newest envelope for the given topic OR null if there are no envelopes on the topic"
        }
      },
      "title": "Response to GetNewestEnvelopeRequest"
    },
    "message_apiGetNewestEnvelopeResponseResponse": {
      "type": "object",
      "properties": {
        "originatorEnvelope": {
          "$ref": "#/definitions/envelopesOriginatorEnvelope"
        }
      }
    },
    "message_apiPublishPayerEnvelopesRequest": {
      "type": "object",
      "properties": {
        "payerEnvelopes": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/envelopesPayerEnvelope"
          }
        }
      }
    },
    "message_apiPublishPayerEnvelopesResponse": {
      "type": "object",
      "properties": {
        "originatorEnvelopes": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/envelopesOriginatorEnvelope"
          }
        }
      }
    },
    "message_apiQueryEnvelopesRequest": {
      "type": "object",
      "properties": {
        "query": {
          "$ref": "#/definitions/message_apiEnvelopesQuery"
        },
        "limit": {
          "type": "integer",
          "format": "int64"
        }
      },
      "title": "Query envelopes request"
    },
    "message_apiQueryEnvelopesResponse": {
      "type": "object",
      "properties": {
        "envelopes": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/envelopesOriginatorEnvelope"
          }
        }
      },
      "title": "Query envelopes response"
    },
    "message_apiSubscribeEnvelopesRequest": {
      "type": "object",
      "properties": {
        "query": {
          "$ref": "#/definitions/message_apiEnvelopesQuery"
        }
      },
      "title": "Batch subscribe to envelopes"
    },
    "message_apiSubscribeEnvelopesResponse": {
      "type": "object",
      "properties": {
        "envelopes": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/envelopesOriginatorEnvelope"
          }
        }
      },
      "title": "Streamed response for batch subscribe - can be multiple envelopes at once"
    },
    "protobufAny": {
      "type": "object",
      "properties": {
        "@type": {
          "type": "string"
        }
      },
      "additionalProperties": {}
    },
    "rpcStatus": {
      "type": "object",
      "properties": {
        "code": {
          "type": "integer",
          "format": "int32"
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/protobufAny"
          }
        }
      }
    },
    "xmtpv4envelopesCursor": {
      "type": "object",
      "properties": {
        "nodeIdToSequenceId": {
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "format": "uint64"
          }
        }
      },
      "description": "The last seen entry per originator. Originators that have not been seen are omitted."
    },
    "xmtpv4message_apiGetInboxIdsRequest": {
      "type": "object",
      "properties": {
        "requests": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/xmtpv4message_apiGetInboxIdsRequestRequest"
          }
        }
      },
      "title": "Request to retrieve the XIDs for the given addresses"
    },
    "xmtpv4message_apiGetInboxIdsRequestRequest": {
      "type": "object",
      "properties": {
        "identifier": {
          "type": "string"
        },
        "identifierKind": {
          "$ref": "#/definitions/associationsIdentifierKind"
        }
      },
      "title": "A single request for a given address"
    },
    "xmtpv4message_apiGetInboxIdsResponse": {
      "type": "object",
      "properties": {
        "responses": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/xmtpv4message_apiGetInboxIdsResponseResponse"
          }
        }
      },
      "title": "Response with the XIDs for the requested addresses"
    },
    "xmtpv4message_apiGetInboxIdsResponseResponse": {
      "type": "object",
      "properties": {
        "identifier": {
          "type": "string"
        },
        "inboxId": {
          "type": "string"
        },
        "identifierKind": {
          "$ref": "#/definitions/associationsIdentifierKind"
        }
      },
      "title": "A single response for a given address"
    }
  }
}