API Reference

API Reference

Complete ACP protocol API reference documentation based on OpenAPI 3.1 specification.

🔗 Basic Information

  • API Version: 2025-09-29
  • Protocol: HTTPS
  • Authentication: Bearer Token
  • Content Type: application/json

🔐 Authentication

All API requests must include a valid Bearer token:

Authorization: Bearer <your-api-token>

📋 Common Headers

Required Headers

  • Authorization: Bearer <token> - API authentication token
  • API-Version: 2025-09-29 - API version identifier
  • Content-Type: application/json - Request content type

Recommended Headers

  • Idempotency-Key: <unique-key> - Idempotency key
  • Request-Id: <correlation-id> - Request correlation ID
  • Accept-Language: en-US - Preferred language
  • User-Agent: <client-info> - Client information

Optional Headers (Security Enhancement)

  • Signature: <base64url-signature> - Request signature
  • Timestamp: <RFC3339-timestamp> - Request timestamp

🛒 Agentic Checkout API

Create Checkout Session

Create a new checkout session to initialize cart state.

POST /checkout_sessions

Request Body:

{
  "items": [
    {
      "id": "prod_12345",
      "quantity": 2
    }
  ],
  "buyer": {
    "first_name": "John",
    "last_name": "Smith",
    "email": "[email protected]",
    "phone_number": "+1-555-123-4567"
  },
  "fulfillment_address": {
    "name": "John Smith",
    "line_one": "1234 Chat Road",
    "line_two": "Suite 100",
    "city": "San Francisco",
    "state": "CA",
    "country": "US",
    "postal_code": "94102"
  }
}

Response (201 Created):

{
  "id": "checkout_session_abc123",
  "payment_provider": {
    "provider": "stripe",
    "supported_payment_methods": ["card"]
  },
  "status": "ready_for_payment",
  "currency": "usd",
  "line_items": [
    {
      "id": "line_item_456",
      "item": {
        "id": "prod_12345",
        "quantity": 2
      },
      "base_amount": 5998,
      "discount": 600,
      "subtotal": 5398,
      "tax": 540,
      "total": 5938
    }
  ],
  "fulfillment_address": {
    "name": "John Smith",
    "line_one": "1234 Chat Road",
    "line_two": "Suite 100",
    "city": "San Francisco",
    "state": "CA",
    "country": "US",
    "postal_code": "94102"
  },
  "fulfillment_option_id": "standard_shipping",
  "fulfillment_options": [
    {
      "type": "shipping",
      "id": "standard_shipping",
      "title": "Standard Shipping",
      "subtitle": "3-5 business days",
      "carrier": "USPS",
      "earliest_delivery_time": "2025-10-12T09:00:00Z",
      "latest_delivery_time": "2025-10-15T18:00:00Z",
      "subtotal": 1500,
      "tax": 0,
      "total": 1500
    },
    {
      "type": "shipping", 
      "id": "express_shipping",
      "title": "Express Shipping",
      "subtitle": "1-2 business days",
      "carrier": "FedEx",
      "earliest_delivery_time": "2025-10-10T09:00:00Z",
      "latest_delivery_time": "2025-10-11T18:00:00Z",
      "subtotal": 3000,
      "tax": 0,
      "total": 3000
    }
  ],
  "totals": [
    {
      "type": "items_base_amount",
      "display_text": "Items total",
      "amount": 5998
    },
    {
      "type": "items_discount",
      "display_text": "Discount",
      "amount": -600
    },
    {
      "type": "subtotal",
      "display_text": "Subtotal",
      "amount": 5398
    },
    {
      "type": "fulfillment",
      "display_text": "Shipping",
      "amount": 1500
    },
    {
      "type": "tax",
      "display_text": "Tax",
      "amount": 540
    },
    {
      "type": "total",
      "display_text": "Total",
      "amount": 7438
    }
  ],
  "messages": [],
  "links": [
    {
      "type": "terms_of_use",
      "url": "https://acplib.com/legal/terms"
    },
    {
      "type": "privacy_policy", 
      "url": "https://acplib.com/legal/privacy"
    }
  ]
}

Update Checkout Session

Update an existing checkout session’s items, address, or fulfillment options.

POST /checkout_sessions/{checkout_session_id}

Request Body Example (update fulfillment option):

{
  "fulfillment_option_id": "express_shipping"
}

Request Body Example (update items):

{
  "items": [
    {
      "id": "prod_12345",
      "quantity": 3
    },
    {
      "id": "prod_67890", 
      "quantity": 1
    }
  ]
}

Response (200 OK): Returns updated complete session object

Retrieve Checkout Session

Get the current state of a checkout session.

GET /checkout_sessions/{checkout_session_id}

Response (200 OK): Returns complete session object

Complete Checkout Session

Complete checkout using payment information to create an order.

POST /checkout_sessions/{checkout_session_id}/complete

Request Body:

{
  "buyer": {
    "first_name": "John",
    "last_name": "Smith", 
    "email": "[email protected]",
    "phone_number": "+1-555-123-4567"
  },
  "payment_data": {
    "token": "vt_01J8Z3WXYZ9ABC",
    "provider": "stripe",
    "billing_address": {
      "name": "John Smith",
      "line_one": "1234 Chat Road",
      "city": "San Francisco",
      "state": "CA",
      "country": "US",
      "postal_code": "94102"
    }
  }
}

Response (200 OK):

{
  "id": "checkout_session_abc123",
  "status": "completed",
  "order": {
    "id": "ord_xyz789",
    "checkout_session_id": "checkout_session_abc123",
    "permalink_url": "https://acplib.com/orders/ord_xyz789"
  },
  "currency": "usd",
  "line_items": [...],
  "totals": [...],
  "messages": [
    {
      "type": "info",
      "content_type": "plain",
      "content": "Order successfully created. We'll ship your items soon."
    }
  ]
}

Cancel Checkout Session

Cancel an uncompleted checkout session.

POST /checkout_sessions/{checkout_session_id}/cancel

Response (200 OK):

{
  "id": "checkout_session_abc123",
  "status": "canceled",
  "messages": [
    {
      "type": "info",
      "content_type": "plain", 
      "content": "Checkout session has been canceled."
    }
  ]
}

💳 Delegated Payment API

Create Delegated Payment Token

Create a delegated token for payment credentials for subsequent payment processing.

POST /agentic_commerce/delegate_payment

Request Body:

{
  "payment_method": {
    "type": "card",
    "card_number_type": "fpan",
    "virtual": false,
    "number": "4242424242424242",
    "exp_month": "12",
    "exp_year": "2026",
    "name": "John Smith",
    "cvc": "123",
    "checks_performed": ["avs", "cvv"],
    "iin": "424242",
    "display_card_funding_type": "credit",
    "display_wallet_type": null,
    "display_brand": "visa",
    "display_last4": "4242",
    "metadata": {
      "issuing_bank": "Chase Bank"
    }
  },
  "allowance": {
    "reason": "one_time",
    "max_amount": 7438,
    "currency": "usd",
    "checkout_session_id": "checkout_session_abc123",
    "merchant_id": "acplib_merchant",
    "expires_at": "2025-10-09T15:30:00Z"
  },
  "billing_address": {
    "name": "John Smith",
    "line_one": "1234 Chat Road",
    "line_two": "Suite 100",
    "city": "San Francisco",
    "state": "CA",
    "country": "US",
    "postal_code": "94102"
  },
  "risk_signals": [
    {
      "type": "card_testing",
      "score": 15,
      "action": "authorized"
    }
  ],
  "metadata": {
    "source": "chatgpt",
    "session_id": "chat_session_123",
    "user_agent": "Mozilla/5.0..."
  }
}

Response (201 Created):

{
  "id": "vt_01J8Z3WXYZ9ABC",
  "created": "2025-09-29T11:00:00Z",
  "metadata": {
    "source": "agent_checkout",
    "merchant_id": "acplib_merchant",
    "idempotency_key": "idem_abc123"
  }
}

📊 Data Models

CheckoutSession Object

FieldTypeDescription
idstringSession unique identifier
statusenumSession status: not_ready_for_payment, ready_for_payment, completed, canceled, in_progress
currencystringISO 4217 currency code (lowercase)
line_itemsLineItem[]Order line items list
fulfillment_addressAddressShipping address
fulfillment_optionsFulfillmentOption[]Available shipping options
fulfillment_option_idstringSelected shipping option ID
totalsTotal[]Amount summary list
payment_providerPaymentProviderPayment service provider info
buyerBuyerBuyer information
messagesMessage[]Message list
linksLink[]Related links
orderOrderOrder information (completed status only)

LineItem Object

FieldTypeDescription
idstringLine item unique identifier
itemItemProduct information
base_amountintegerBase amount (minor units)
discountintegerDiscount amount (minor units)
subtotalintegerSubtotal amount (minor units)
taxintegerTax amount (minor units)
totalintegerTotal amount (minor units)

PaymentMethod Object

FieldTypeRequiredDescription
typestringPayment method type (currently only “card” supported)
card_number_typeenumCard number type: fpan, network_token
virtualbooleanWhether it’s a virtual card
numberstringCard number/token
exp_monthstringExpiry month (01-12)
exp_yearstringExpiry year (four digits)
namestringCardholder name
cvcstringSecurity code
display_card_funding_typeenumCard type: credit, debit, prepaid
display_brandstringCard brand (e.g., “visa”, “mastercard”)
display_last4stringLast four digits of card

⚠️ Error Handling

All error responses use a unified flat object format:

{
  "type": "invalid_request",
  "code": "missing_field",
  "message": "Missing required field 'items'",
  "param": "$.items"
}

Error Types

TypeHTTP StatusDescription
invalid_request400Request format error or missing required fields
request_not_idempotent409Idempotency conflict
processing_error422Business logic processing error
rate_limit_exceeded429Request rate limit exceeded
service_unavailable503Service temporarily unavailable

Common Error Codes

CodeDescription
missing_fieldMissing required field
invalid_fieldInvalid field value
out_of_stockProduct out of stock
payment_declinedPayment declined
idempotency_conflictIdempotency key conflict
session_not_foundSession not found
session_already_completedSession already completed

🔄 Idempotency

To ensure operation idempotency, it’s recommended to use the Idempotency-Key header in create and complete operations:

Idempotency-Key: unique-operation-key-123
  • Repeated requests with the same key and same parameters will return the same result
  • Requests with the same key but different parameters will return a 409 conflict error

📏 Limits and Constraints

Request Limits

  • Maximum request body size: 1MB
  • API call rate: 100 requests per second
  • Timeout: 30 seconds

Data Limits

  • Item quantity: Maximum 100 items per session
  • Address length: See Address object definition for field limits
  • Currency precision: Use integers in minor units

Session Lifecycle

  • Session validity: 24 hours
  • Payment token validity: Specified by allowance.expires_at
  • Maximum retry attempts: 3 times

Through following this API reference documentation, you can correctly implement all ACP protocol interfaces to ensure seamless integration with ChatGPT and other AI agents.