# Syncgateway attachment document

#1

From the documentation, could see that am able to attach content to existing document which expects revision of existing document. from this way i will be having two revisions of document.
how can i insert document with content as attachment with one revision in couchbase which should include attachment and document content as well.

#2

@arihant_rk

If you are using the Sync Gateway REST API directly, you can inline your attachments as base64 encoded strings when you create the document (see “data” property below) e.g.

`curl -X PUT http://localhost:4985/db/doc100 -d '{"_attachments": {"message.txt": {"data": "aGVsbG8sIENvdWNoIQ==", "content_type": "text/plain"}}}' -H "Content-Type:application/json"`

#3

Thanks Andy. it was very helpful.