Generate text

To generate text you need a premise ID and a dictionary containing keys that are the the required fields for the premise fields and values that contain the actual data.

Here is a basic example for a sentence premise where the required datapoints would have been [' first_name', 'person_description'].

{
	"first_name": "Mark",
	"person_description": "This is my description of someone..."
}

If you do not know the required fields for your premise ID use the get premise endpoint.

Generate text for personalizing contacts or for generating entire emails.

POST https://app.copyfactory.io/api/v2/generate/

Headers

Name
Type
Description

Authorization*

string

Your Copyfactory API key

Request Body

Name
Type
Description

premise_id*

int

The ID of the sentence premise you wish to use.

variables*

object

A dictionary with keys containing the required data fields and values which contain the actual contact data.

{
	"status": "success",
	"content": "This is the generated sentence based on the prospect data.",
	"meta_data": {
		"sentence_premise": {
			"id": 20,
			"order": 1,
			"is_active": False,
			"required_variables": ["first_name", "company_description"],
			"sentence_premise_name": "Company - Edited",
			"profile_name": "Copyfactory"
		},
		"variables": {
			"first_name": "Mark",
			"company_description": "This is my company description"
		}
	}
}
curl --location --request POST 'https://app.copyfactory.io/api/v2/generate/' \
--header 'Authorization: API-KEY' \
--header 'Content-Type: application/json' \
--data-raw '{
            "premise_id": PREMISE_ID,
            "variables": {"field_name":"field data"}
}'

Last updated