Rest API: exposing SVG real strokes

It would be extremely useful to have raw SVG paths exposed for the PATH object type. Not the path outlines, just the d attribute of the path. Not having this has make the api essentially unworkable for certain things, like when the absolute smallest SVG possible is required.

The only way to programmatically get the real path commands for a PATH type object is to go through the image rest api, retrieve the svg and parse it to get the d attribute.

Hey @Gavin_Atkinson1! Can you help me better understand what you mean by “PATH” object type and “the path outlines”? Are you referring to the Path arrays in strokeGeometry and in fillGeometry on Vector nodes in the REST API?

Sure! What I want is the path command that corresponds to the purple line, but the API gives me the dashed line, which is the outlined stroke. I’m referring to the path arrays in strokeGeometry, since fillGeometry is empty for figma path elements.
Screenshot 2023-04-20 at 7.15.06 PM

The only way I know how to achieve this image is to outline a stroke, which turns it into a shape, then apply a stroke to that shape.

If that is what you are doing, the information represented by your purple line no longer exists for the node. That loss happens when you outline the stroke and all the information we have to provide is the dashed line stroke geometry.

Am I understanding that correctly? Can you share a file with this node in it if not?

Sorry - let me try to explain again.

In your example - I want to get the path command that draws the black line, but what I get out of the API is the path command that draws the outline of the path stroke, as if I had clicked ‘outline stroke’.

yeah, sorry if what i was saying wasnt clear. i had to outline the black line to get the dashed line. if i didn’t outline the black line, i would get the code you are looking for. you’re saying the stroke you have isn’t outlined and it is returning an outlined path? that should not be happening.

yes, thats what I’m saying. by the way - i think the reason behind this is because SVG doesn’t support stroke ‘sidedness’ aka outside center inside. So I understand why someone might design the api response this way. I just wish it were an option.

just a note - the dashed line is just how stroke outlines look in command+y mode in the app.