Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Developer CommunityDocumentation How to programmatically create a “code snippet” in a confluence clo

Erick Machuca
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
October 15, 2025

Hello,
I have successfully created a Confluence page that includes a “code block” macro via REST API. In the body of the API call I use “representation” = “wiki”, then, the code block starts with “{code:linenumbers=true|firstline=0001|collapse=true}”.
I read that the “code block” macro (and others) will be DA on Feb 2026. Recommendation is to use the “code snippet” element.
This document shows how to use the new “code snippet” from GUI. I am unable to find information about doing this programmatically via REST API… Any leads/ideas?
Thank you in advance.

1 answer

0 votes
Tomislav Tobijas
Community Champion
October 16, 2025

Hi @Erick Machuca ,

I haven't been playing with this, but as far as I know, there's no official docs or REST API support for inserting the new "code snippet" macro. Here's a somewhat relevant article: Insert the code block macro 

Now, what I would suggest (and you've mentioned this in the title), is to check Developer Community, where you might find or get some better assistance on the matter (or at least suggestions for potential workarounds).

Cheers,
Tobi

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Product Admin
TAGS
AUG Leaders

Atlassian Community Events