Books
Books · Acciones GPT
Thrads API
API for serving hyper-targeted ads based on user conversation.
POST /serve-ad/Request an ad based on user messages.
Esquema original API
{
"openapi": "3.1.0",
"info": {
"title": "Thrads API",
"version": "1.0.0",
"description": "API for serving hyper-targeted ads based on user conversation."
},
"servers": [
{
"url": "https://api.thrads.us/developer",
"description": "Production server"
}
],
"paths": {
"/serve-ad/": {
"post": {
"summary": "Request an ad based on user messages.",
"operationId": "serveAd",
"requestBody": {
"required": true,
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AdRequest"
}
}
}
},
"responses": {
"200": {
"description": "Ad served or no ad opportunity.",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/AdResponse"
}
}
}
},
"400": {
"description": "Bad request."
},
"401": {
"description": "Unauthorized."
},
"500": {
"description": "Server error."
}
}
}
}
},
"components": {
"schemas": {
"AdRequest": {
"type": "object",
"required": [
"userId",
"userRegion",
"content"
],
"properties": {
"userId": {
"type": "string",
"description": "Unique user identifier."
},
"userRegion": {
"type": "string",
"description": "User's region (use \"US\" if unsure)."
},
"content": {
"type": "object",
"required": [
"user",
"chatbot"
],
"properties": {
"user": {
"type": "string",
"description": "Last message from the user."
},
"chatbot": {
"type": "string",
"description": "Last message from the chatbot."
}
}
},
"force": {
"type": "boolean",
"description": "Force ads should always be true.",
"default": true
}
}
},
"AdResponse": {
"type": "object",
"properties": {
"status": {
"type": "string",
"enum": [
"success",
"error"
],
"description": "Response status."
},
"message": {
"type": "string",
"description": "Response message."
},
"data": {
"type": "object",
"nullable": true,
"properties": {
"creative": {
"type": "string",
"description": "Ad content."
},
"prod_name": {
"type": "string",
"description": "Product name."
},
"prod_url": {
"type": "string",
"format": "uri",
"description": "Product URL."
},
"img_url": {
"type": "string",
"format": "uri",
"description": "Image URL."
},
"price": {
"type": "string",
"description": "Product price."
},
"currency": {
"type": "string",
"description": "Price currency."
}
}
},
"errors": {
"type": "object",
"nullable": true,
"additionalProperties": {
"type": "string",
"description": "Error details if any."
}
}
}
}
},
"securitySchemes": {
"apiKeyAuth": {
"type": "apiKey",
"in": "header",
"name": "X-Thrads-Api-Key",
"description": "API key for authentication."
}
}
},
"security": [
{
"apiKeyAuth": []
}
]
}