Coupa

Learn how to use Coupa with Composio

Overview

SLUG: COUPA

Description

Coupa provides a comprehensive business spend management platform with procurement, invoicing, and expense capabilities.

Authentication Details

client_id
stringRequired
client_secret
stringRequired
oauth_redirect_uri
stringDefaults to https://backend.composio.dev/api/v1/auth-apps/add
scopes
stringDefaults to openid,profile,email,login,offline_access,core.common.read,core.object_translations.read,core.user.read,core.user_group.read,core.integration.read,core.integration.write,core.approval.read,core.approval.write,core.requisition.read,core.requisition.write,core.purchase_order.read,core.purchase_order.write,core.order_header_confirmations.read,core.order_header_confirmations.write,core.item.read,core.catalog.read,core.uom.read,core.supplier.read,core.supplier_sites.read,core.invoice.read,core.invoice.write,core.invoice.create,core.payables.invoice.read,core.payables.invoice.write,core.pay.payments.read,core.expense.read,core.expense.write,core.business_entity.read,core.legal_entity.read,core.project.read,core.notifications_summary.read
full
stringDefaults to https://your-instance.coupacloud.comRequired

Connecting to Coupa

Create an auth config

Use the dashboard to create an auth config for the Coupa toolkit. This allows you to connect multiple Coupa accounts to Composio for agents to use.

1

Select App

Navigate to Coupa.

2

Configure Auth Config Settings

Select among the supported auth schemes of and configure them here.

3

Create and Get auth config ID

Click “Create Coupa Auth Config”. After creation, copy the displayed ID starting with ac_. This is your auth config ID. This is not a sensitive ID — you can save it in environment variables or a database. This ID will be used to create connections to the toolkit for a given user.

Connect Your Account

Using OAuth2

1from composio import Composio
2
3# Replace these with your actual values
4coupa_auth_config_id = "ac_YOUR_COUPA_CONFIG_ID" # Auth config ID created above
5user_id = "0000-0000-0000" # UUID from database/application
6
7composio = Composio()
8
9
10def authenticate_toolkit(user_id: str, auth_config_id: str):
11 connection_request = composio.connected_accounts.initiate(
12 user_id=user_id,
13 auth_config_id=auth_config_id,
14 )
15
16 print(
17 f"Visit this URL to authenticate Coupa: {connection_request.redirect_url}"
18 )
19
20 # This will wait for the auth flow to be completed
21 connection_request.wait_for_connection(timeout=15)
22 return connection_request.id
23
24
25connection_id = authenticate_toolkit(user_id, coupa_auth_config_id)
26
27# You can also verify the connection status using:
28connected_account = composio.connected_accounts.get(connection_id)
29print(f"Connected account: {connected_account}")

Tools

Executing tools

To prototype you can execute some tools to see the responses and working on the Coupa toolkit’s playground

Python
1from composio import Composio
2from openai import OpenAI
3import json
4
5openai = OpenAI()
6composio = Composio()
7
8# User ID must be a valid UUID format
9user_id = "0000-0000-0000" # Replace with actual user UUID from your database
10
11tools = composio.tools.get(user_id=user_id, toolkits=["COUPA"])
12
13print("[!] Tools:")
14print(json.dumps(tools))
15
16def invoke_llm(task = "What can you do?"):
17 completion = openai.chat.completions.create(
18 model="gpt-4o",
19 messages=[
20 {
21 "role": "user",
22 "content": task, # Your task here!
23 },
24 ],
25 tools=tools,
26 )
27
28 # Handle Result from tool call
29 result = composio.provider.handle_tool_calls(user_id=user_id, response=completion)
30 print(f"[!] Completion: {completion}")
31 print(f"[!] Tool call result: {result}")
32
33invoke_llm()

Tool List

Tool Name: List Approvals

Description

Tool to list approvals with optional pagination and filters. Use when you need to retrieve multiple approval records.

Action Parameters

fields
string
filters
object
limit
integer
offset
integer
return_object
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Reject Approval

Description

Tool to reject an approval. Use when you need to programmatically reject a pending approval by ID.

Action Parameters

id
integerRequired
note
string
reason
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Approval

Description

Tool to retrieve a single approval record. Use when you need detailed approval information by ID.

Action Parameters

id
integerRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Ignore Window And Issue

Description

Ignore Window And Issue

Action Parameters

fields
string
id
integerRequired
return_object
string
x-coupa-api-user-login
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Revalidate Invoice Tolerances

Description

Tool to revalidate tolerances on an invoice. Use when tolerance checks need rerunning after invoice submission issues.

Action Parameters

id
integerRequired
return_object
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update Invoice

Description

Tool to update an invoice via PUT /api/invoices/:id.

Action Parameters

bill-to-address
object
business_role
string
comments
string
currency
object
fields
string
id
integerRequired
internal-note
string
invoice-date
string
invoice-lines
array
invoice-number
string
line-level-taxation
boolean
lock-version-key
integer
on_behalf_of
string
payload
object
payment-term
object
remit-to-address
object
return_object
string
ship-to-address
object
status
string
supplier
object
taggings
array
tags
array
tax-lines
array

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Payment Terms

Description

Tool to list payment terms with filters.

Action Parameters

active
boolean
code
string
code_contains
string
code_ends_with
string
code_starts_with
string
created_at_gt
string
created_at_lt
string
days_for_discount_payment
integer
days_for_net_payment
integer
discount_cutoff_day
integer
discount_due_day
integer
discount_due_month
integer
discount_rate
number
fields
string
limit
integer
net_cutoff_day
integer
net_due_day
integer
net_due_month
integer
offset
integer
return_object
string
type
string
updated_at_gt
string
updated_at_lt
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Purchase Order Attachment

Description

Tool to create an attachment on a purchase order. Use when attaching files, text, or URLs to purchase orders.

Action Parameters

attachment[file]
object
attachment[intent]
string
attachment[text]
string
attachment[type]
stringRequired
attachment[url]
string
purchase_order_id
integerRequired
x-coupa-api-user-login
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Add To Cart

Description

Tool to add items from a requisition to the shopping cart. Use after constructing the add_to_cart payload.

Action Parameters

payload
objectRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Create Requisition

Description

Tool to create a new requisition. Endpoint: POST /api/requisitions

Action Parameters

payload
objectRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Get Current Cart

Description

Tool to get the current user's requisition cart. Use when you need to fetch or initialize the current cart for the authenticated user.

Action Parameters

fields
string
return_object
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Delete Requisition

Description

Tool to delete a requisition. Use when you need to permanently remove a requisition by ID.

Action Parameters

id
integerRequired
return_object
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Requisitions

Description

Tool to list requisitions with filters.

Action Parameters

fields
string
limit
integer
offset
integer
requested-by[login]
string
return_object
string
status
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List My Requisitions

Description

Tool to list the authenticated user's requisitions. Use when you need to retrieve paginated user requisitions with optional filters.

Action Parameters

created-at
string
fields
string
limit
integer
offset
integer
requested-by[login]
string
return_object
string
status
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Remove Approver from Requisition

Description

Tool to remove an approver from a requisition. Use when you need to remove a manually added approver from a requisition. Endpoint: PUT /api/requisitions/:id/remove_approval

Action Parameters

api_user_email
string
api_user_id
integer
api_user_login
string
approval_id
integer
approver_id
integer
id
integerRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Save Requisition for Later

Description

Tool to save a requisition for later. Use when you need to stash a draft requisition without submitting it.

Action Parameters

fields
string
id
integerRequired
return_object
string

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Submit Requisition for Approval

Description

Tool to submit a requisition for approval. Use when you need to create a requisition and immediately submit it for approval.

Action Parameters

payload
objectRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: Update and Submit for Approval

Description

Tool to update a requisition and submit it for approval. Endpoint: PUT /api/requisitions/:id/update_and_submit_for_approval

Action Parameters

id
integerRequired
requisition-header
objectRequired

Action Response

data
objectRequired
error
string
successful
booleanRequired

Tool Name: List Users

Description

Tool to list users. Use when you need to retrieve multiple user records with optional pagination and filtering.

Action Parameters

fields
string
limit
integer
offset
integer
return_object
string
status
string

Action Response

data
objectRequired
error
string
successful
booleanRequired