POST
/
api
/
v1
/
save_demo
Create a new goal with file attachments
curl --request POST \
  --url https://api.optexity.com/api/v1/save_demo \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: <api-key>' \
  --data '{
  "url": "<string>",
  "files": [
    "<string>"
  ]
}'
{
  "success": true,
  "goal_id": "<string>",
  "message": "<string>"
}

Create a New Goal with File Attachments

This endpoint allows you to create a new goal with optional file attachments. The files will be stored in Supabase Storage and their URLs will be saved with the goal.

Request Headers

HeaderTypeRequiredDescription
x-api-keystringYesYour API key for authentication

Request Body

FieldTypeRequiredDescription
urlstringYesThe URL associated with the goal
filesarray<string>YesArray of file URLs or file data to be attached to the goal

Example Request

curl -X POST /api/v1/save_demo \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "url": "https://example.com/workflow",
    "files": [
      "https://example.com/file1.pdf",
      "https://example.com/file2.jpg"
    ]
  }'

Example Response

{
  "success": true,
  "goal_id": "goal_123456789",
  "message": "Goal created successfully with 2 file attachments"
}

Error Responses

400 Bad Request
{
  "error": "Missing required fields: url, files"
}
401 Unauthorized
{
  "error": "Invalid API key"
}
500 Internal Server Error
{
  "error": "Failed to store files in Supabase Storage"
}

Authorizations

x-api-key
string
header
required

Body

application/json

Response

200
application/json

Goal created successfully

The response is of type object.