Yeah I just tried it and it seems like the API it doesn’t give out all the fields listed in the docs. I tried getting the full file using /file/:key
and then a specific node using /file/:key/nodes=125:27
endpoint. I don’t understand what’s wrong…
Solution.
Ok turns out I just needed to read the docs better. When getting a specific node by id, you also need to specify &geometry=paths
query parameter. This returns all the necessary data, such as size and transform matrix. For this specific node:
{
"name": "EditUser (Copy)",
"lastModified": "2021-02-18T23:24:52Z",
"thumbnailUrl": "https://s3-alpha-sig.figma.com/thumbnails/8a442f2d-25f5-46bb-8d40-807518fb3424?Expires=1614556800&Signature=E0c-96j8CT9TK2isSj7j2CJSdvQdrnmbP1IgrJnN3KQp0lNIavvaF0mfs05rk9YMaezMCFXX0ilAZiRUjF26x6FDp4AaNH3EagweGXeD7xVZQX1ZfzulcRQ7yrMN6X8shhjMIETltMJV9rYU4EGxq8IXq3uVtu4Q7G~dTlKh6wSAbjMCuTLtpP44nXtc1pjZz36nvbwMa0XZbrkRU6tLwQmctdEDY5t8mn58iUGL6C9ldV3Joi-PCb5iVZDbNORbk~TuskZ2gxIeGMnsjTq-VsUWob3~IRCMj6S14F2yLfOwJZf6DoNXjypBUOHJiyH6UVwPK3aniDeFoBstLVlI7A__&Key-Pair-Id=APKAINTVSUGEWH5XD5UA",
"version": "686304844",
"role": "editor",
"nodes": {
"125:27": {
"document": {
"id": "125:27",
"name": "lastNameField",
"type": "RECTANGLE",
"blendMode": "PASS_THROUGH",
"absoluteBoundingBox": {
"x": 464.59423828125,
"y": 188.33920288085938,
"width": 167.38670349121094,
"height": 120.3416748046875
},
"constraints": { "vertical": "TOP", "horizontal": "LEFT" },
"relativeTransform": [
[0.83867049217224121, 0.54463905096054077, 464.59423828125],
[
-0.54463905096054077,
0.83867049217224121,
288.55279541015625
]
],
"size": { "x": 184.0, "y": 24.0 },
"fills": [
{
"blendMode": "NORMAL",
"type": "SOLID",
"color": {
"r": 0.99583333730697632,
"g": 0.99583333730697632,
"b": 0.99583333730697632,
"a": 1.0
}
}
],
"fillGeometry": [
{
"path": "M0 7C0 3.13401 3.13401 0 7 0L177 0C180.866 0 184 3.13401 184 7L184 17C184 20.866 180.866 24 177 24L7 24C3.13401 24 0 20.866 0 17L0 7Z",
"windingRule": "NONZERO"
}
],
"strokes": [
{
"blendMode": "NORMAL",
"type": "SOLID",
"color": { "r": 0.0, "g": 0.0, "b": 0.0, "a": 1.0 }
}
],
"strokeWeight": 1.0,
"strokeAlign": "INSIDE",
"strokeGeometry": [
{
"path": "M7 1L177 1L177 -1L7 -1L7 1ZM183 7L183 17L185 17L185 7L183 7ZM177 23L7 23L7 25L177 25L177 23ZM1 17L1 7L-1 7L-1 17L1 17ZM7 23C3.68629 23 1 20.3137 1 17L-1 17C-1 21.4183 2.58173 25 7 25L7 23ZM183 17C183 20.3137 180.314 23 177 23L177 25C181.418 25 185 21.4183 185 17L183 17ZM177 1C180.314 1 183 3.68629 183 7L185 7C185 2.58172 181.418 -1 177 -1L177 1ZM7 -1C2.58172 -1 -1 2.58172 -1 7L1 7C1 3.68629 3.68629 1 7 1L7 -1Z",
"windingRule": "NONZERO"
}
],
"effects": [],
"cornerRadius": 7.0,
"rectangleCornerRadii": [7.0, 7.0, 7.0, 7.0]
},
"components": {},
"schemaVersion": 0,
"styles": {}
}
}
}
The full command I used: curl -sH 'X-Figma-Token: YOUR-TOKEN' 'https://api.figma.com/v1/files/6LbL35bbnCvcrWZm6qSPE6/nodes?ids=125:27&geometry=paths' > figma.json