Retrieve a list of message

Fetch a list of messages with optional filters like prefix, public, unpublished, and pagination using limit and next token.

GET

Parameters

Query Parameters

Id
Filter resources by their unique identifier
Limit
How many items to return at one time (max 100)
Autocomplete
Search term for autocomplete functionality
Next
Pagination token for retrieving the next page of results
Order
Sort order for the results (ascending or descending)
SortBy
Field name to sort the results by
Template_id
Filter messages by template ID.
To
Filter messages by recipient.
Language
language of the message
System
Filter messages that are publicly accessible.
Action_type
Filter type of messages.
Status
Filter messages by status.
When_created[$gt]
When_created[$lt]
When_created[$gte]
When_created[$lte]
Status codeDescription
200A list of templates and the next pagination token.
400Bad request error - the request contains invalid parameters or malformed data
500Internal server error - an unexpected error occurred on the server
cURL
curl -L \
"https://blockv-labs.io/messages?id={id}&limit={limit}&autocomplete={autocomplete}&next={next}&order={order}&sortBy={sortBy}&template_id={template_id}&to={to}&language={language}&system={system}&action_type={action_type}&status={status}&when_created[$gt]={when_created[$gt]}&when_created[$lt]={when_created[$lt]}&when_created[$gte]={when_created[$gte]}&when_created[$lte]={when_created[$lte]}" \
-H 'Accept: application/json'
Response
{
"messages": [
{
"id": "string",
"template_id": "string",
"action_type": "register",
"to": "SP318Q55DEKHRXJK696033DQN5C54D9K2EE6DHRWP",
"system": "email",
"language": "en",
"status": "pending",
"scheduled_at": "2024-01-01T00:00:00Z",
"error": {
"code": 0,
"message": "Error message"
},
"when_modified": "2024-01-01T00:00:00Z",
"when_created": "2024-01-01T00:00:00Z"
}
],
"next": "string"
}
json
{
"type": "object",
"required": [
"messages"
],
"properties": {
"messages": {
"type": "array",
"description": "Array of messages.",
"items": {
"type": "object",
"description": "Notification message entity for sending communications to users through various channels",
"required": [
"id",
"to",
"system",
"language",
"action_type",
"status",
"when_modified",
"when_created"
],
"properties": {
"id": {
"type": "string",
"description": "Unique identifier for the notification message",
"x-oapi-codegen-extra-tags": {
"bson": "_id",
"json": "id"
},
"x-go-type": "id.ID",
"x-go-type-import": {
"path": "github.com/vlabsio/smarttoken/pkg/types/id"
},
"x-go-type-skip-optional-pointer": true
},
"template_id": {
"type": "string",
"description": "Template identifier used to format the message content",
"x-oapi-codegen-extra-tags": {
"bson": "template_id"
},
"x-go-type": "id.ID",
"x-go-type-import": {
"path": "github.com/vlabsio/smarttoken/pkg/types/id"
}
},
"action_type": {
"description": "Type of action that triggered this notification",
"type": "string",
"enum": [
"register",
"login",
"reset",
"verify",
"otp",
"org_invite",
"custom",
"internal"
],
"x-oapi-codegen-extra-tags": {
"bson": "action_type,omitempty",
"validate": "omitempty"
}
},
"to": {
"type": "string",
"description": "Recipient address (email, phone number, etc.) for the notification",
"x-oapi-codegen-extra-tags": {
"bson": "to,omitempty"
}
},
"system": {
"type": "string",
"enum": [
"email",
"sms",
"push"
],
"x-oapi-codegen-extra-tags": {
"bson": "system,omitempty"
},
"description": "Notification system/channel to be used for delivery"
},
"language": {
"type": "string",
"enum": [
"en",
"es",
"fr",
"de",
"it",
"pt",
"ru"
],
"x-oapi-codegen-extra-tags": {
"bson": "language,omitempty",
"form": "language",
"validate": "omitempty,oneof=en es fr de it pt ru"
},
"description": "Language preference for the notification content"
},
"status": {
"type": "string",
"enum": [
"pending",
"delivered",
"failed",
"scheduled",
"cancelled",
"retrying"
],
"x-oapi-codegen-extra-tags": {
"bson": "status",
"json": "status"
},
"description": "Current delivery status of the notification message"
},
"scheduled_at": {
"type": "string",
"format": "date-time",
"description": "The time at which the message should be sent.",
"x-oapi-codegen-extra-tags": {
"bson": "scheduled_at,omitempty"
}
},
"error": {
"description": "Error information if message delivery failed",
"type": "object",
"required": [
"code",
"message"
],
"properties": {
"code": {
"type": "integer",
"format": "int32"
},
"message": {
"type": "string"
},
"details": {
"type": "object",
"x-go-type": "any",
"x-go-type-skip-optional-pointer": true
}
}
},
"when_modified": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the message was last modified",
"x-oapi-codegen-extra-tags": {
"bson": "when_modified,omitempty"
},
"x-go-type-skip-optional-pointer": true
},
"when_created": {
"type": "string",
"format": "date-time",
"description": "Timestamp when the message was created",
"x-oapi-codegen-extra-tags": {
"bson": "when_created,omitempty"
},
"x-go-type-skip-optional-pointer": true
}
}
}
},
"next": {
"type": "string",
"description": "Pagination token for the next set of results, if any.",
"x-go-type-skip-optional-pointer": true
}
}
}