Skip to content

    v2_patch_account

    Create a custom tracking field for a brand, edit its definition, or set its value. Set section to the record type you want to change.

    See the REST reference for PATCH /v2/account.

    Signature

    v2_patch_account(
        body: Mapping[str, Any],
    ) -> Response[Any]

    Parameters

    body
    Dictionary for the selected operation. See the REST reference for its required fields.

    Return value

    A successful field creation returns the field ID and revision. Keep both if you plan to edit the field.

    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.

    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_patch_account(
            body={
                'brand_id': '00000000-0000-4000-8000-000000000001',
                'command': {'action': 'field_create', 'label': 'Segment', 'type': 'text'},
                'mutation_id': '00000000-0000-4000-8000-000000000001',
                'section': 'prompt_fields',
            },
        )
        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_patch_account(
                body={
                    'brand_id': '00000000-0000-4000-8000-000000000001',
                    'command': {'action': 'field_create', 'label': 'Segment', 'type': 'text'},
                    'mutation_id': '00000000-0000-4000-8000-000000000001',
                    'section': 'prompt_fields',
                },
            )
            print(response.body)
    
    asyncio.run(main())

    Requests by feature

    Account and usage

    See Python client setup for the environment variables, response properties and retry settings.