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.

If you receive an empty sentence back this is likely due to an error in your variables. Make sure to check the required fields and try again. All generations will contain meta data on the request.

Generate text for personalizing contacts or for generating entire emails.

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

Headers

NameTypeDescription

Authorization*

string

Your Copyfactory API key

Request Body

NameTypeDescription

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