Export
Before getting started: You will need to create your API key to export an image from the API.
Templates can be completely customized from the API by setting the Prop values for each Component, which includes changing the CSS properties, text values, and image sources. View the Components section to inspect all the available Props for each Component.
post
https
://api.mattermix.com/v1/export
Create and return a new Export image

Example post request

1
export const generateImage = async () => {
2
const props = {
3
id: "6184599c8c4951233bae6e3f",
4
imageType: "png",
5
props: [
6
{
7
id: "XYGvTs0C8i",
8
values: [
9
{
10
propKey: "text",
11
value: "Live Panel"
12
}
13
]
14
},
15
{
16
id: "HYXIfJHdSl",
17
values: [
18
{
19
propKey: "text",
20
value: "How to create marketing graphics at scale with Mattermix"
21
}
22
]
23
},
24
{
25
id: "oiPyeyodQ5",
26
values: [
27
{
28
propKey: "text",
29
value: "Friday, November 19, 2021"
30
}
31
]
32
},
33
{
34
id: "uTNh6mi_mY",
35
values: [
36
{
37
propKey: "text",
38
value: "3:00 PM EST"
39
}
40
]
41
},
42
{
43
id: "FKGNb6igso",
44
values: [
45
{
46
propKey: "text",
47
value: "Hunter"
48
}
49
]
50
},
51
{
52
id: "I6X5Dl6wbM",
53
values: [
54
{
55
propKey: "text",
56
value: "Becton"
57
}
58
]
59
},
60
{
61
id: "Cv6q_9i97O",
62
values: [
63
{
64
propKey: "text",
65
value: "Founder"
66
}
67
]
68
},
69
{
70
id: "e6arH7JdBl",
71
values: [
72
{
73
propKey: "text",
74
value: "Mattermix"
75
}
76
]
77
},
78
{
79
id: "oquk7gjAtf",
80
values: [
81
{
82
propKey: "source",
83
value:
84
"https://cdn.mattermix.com/tenants/becton-rwzg4/media/6156778fc5780bfd16578d32-1633099339833.jpeg"
85
}
86
]
87
}
88
]
89
};
90
91
const body = {
92
id: "6184599c8c4951233bae6e3f",
93
imageType: "png",
94
props
95
};
96
97
const res = await fetch("api.mattermix.com/v1/export", {
98
method: "POST",
99
headers: {
100
"Content-Type": "application/json",
101
Authorization: `ApiKey ${process.env.MATTERMIX_API_KEY}`
102
},
103
body: JSON.stringify(body)
104
});
105
106
const { status, message, data } = await res.json();
107
108
if (status !== "success") {
109
console.log(message);
110
} else {
111
console.log(data.newExport.url);
112
}
113
};
114
Copied!
Last modified 2mo ago