v2_post_prompts
Create a prompt for a question you plan to track. Other actions can build suggestions, import prompts or preview them.
See the REST reference for POST /v2/prompts.
Signature
v2_post_prompts(
body: Mapping[str, Any],
*,
idempotency_key: str | None = None,
hubspot_access_token: str | None = None,
) -> Response[Any]Parameters
body- Dictionary for the selected operation. See the REST reference for its required fields.
idempotency_key- Value for Idempotency-Key. For requests that require this header, the SDK generates a UUID if you omit it. Send the original value if your application repeats the same write.
hubspot_access_token- Your HubSpot credential for a connection action that requires it. Omit it for other requests.
Return value
For create, HTTP 201 returns the prompt ID and revision in response.data. Keep the ID to collect answers for that question.
Errors
- AeoApiError includes the HTTP status, error code and request ID. An invalid key raises UnauthenticatedError. Check the key’s scopes if you receive ForbiddenError.
- Invalid arguments can raise ValueError or TypeError before the SDK sends a request.
- AeoTransportError means the request could not reach the API after any allowed retries, or the response could not be read as JSON.
- PreconditionFailedError means the revision has changed. Read the current record before editing it again.
- For a conflict, read the error message before repeating the write. Check the saved record for a competing edit or a repeated request.
Python example
import os
from aeo_sdk import AeoClient
with AeoClient(os.environ["AEO_API_KEY"], base_url=os.environ["AEO_API_BASE_URL"]) as client:
response = client.v2_post_prompts(
body={
'action': 'create',
'category_ids': ['gcid:plumber'],
'intent': 'evaluation',
'market': {'city': 'Chicago', 'country': 'US', 'language': 'en'},
'text': 'What should homeowners compare when choosing a plumber in Chicago?',
},
)
print(response.body)Async example
import asyncio
import os
from aeo_sdk import AsyncAeoClient
async def main():
async with AsyncAeoClient(os.environ["AEO_API_KEY"], base_url=os.environ["AEO_API_BASE_URL"]) as client:
response = await client.v2_post_prompts(
body={
'action': 'create',
'category_ids': ['gcid:plumber'],
'intent': 'evaluation',
'market': {'city': 'Chicago', 'country': 'US', 'language': 'en'},
'text': 'What should homeowners compare when choosing a plumber in Chicago?',
},
)
print(response.body)
asyncio.run(main())Requests by feature
Prompts and topics
See Python client setup for the environment variables, response properties and retry settings.