GrabFood Partner API Python SDK
raw JSON → latest (no versioned releases — install from main branch) verified Tue May 12 auth: no python install: stale quickstart: stale
Official Python SDK for the GrabFood Partner API — enables food delivery merchants and platform partners in Southeast Asia to manage orders, store hours, menus, and campaigns programmatically. Auto-generated from Grab's OpenAPI spec using OpenAPITools PythonClientCodegen. IMPORTANT: This SDK covers GrabFood only (merchant/food delivery). Grab rides/mobility has no official Python SDK. The SDK is not published on PyPI — install via GitHub only.
pip install git+https://github.com/grab/grabfood-api-sdk-python.git Common errors
error ModuleNotFoundError: No module named 'grabfood' ↓
cause The Python SDK was not installed correctly from its GitHub repository, or the `import` statement uses an incorrect package name.
fix
Install the SDK directly from GitHub using
pip install git+https://github.com/grab/grabfood-api-sdk-python.git. Ensure your import statement is import grabfood. error Unauthorized. The access token is invalid. ↓
cause The API request was made without a valid or correctly formatted OAuth bearer token in the `Authorization` header, or the token has expired.
fix
Obtain a fresh and valid OAuth access token through the GrabFood Partner API's OAuth flow and include it in your API requests with the
Authorization: Bearer <your_access_token> header. error grabfood.rest.ApiException: (400) Bad Request ↓
cause A general API call failure occurred, often due to invalid request parameters, incorrect data format, or missing required fields in the API request body.
fix
Inspect the
ApiException object's attributes (e.g., e.status, e.reason, e.body) to retrieve detailed error messages from the GrabFood API, then correct your API call's parameters or payload. Warnings
breaking GrabFood Partner API access requires a signed partnership agreement with Grab. It is not self-serve — you must apply via the Grab Developer Portal and be approved as a merchant or technology partner. Without approval, API credentials are not issued. ↓
fix Apply for partner access at developer.grab.com before starting integration.
gotcha 'grab' on PyPI is a completely unrelated Python web scraping framework (github.com/lorien/grab). pip install grab installs the wrong package. The GrabFood SDK is not on PyPI at all. ↓
fix Install only via GitHub: pip install git+https://github.com/grab/grabfood-api-sdk-python.git
gotcha The SDK default host is STG_ENV (sandbox/staging). Forgetting to switch to PRD_ENV means all production calls hit the sandbox silently — no error is thrown. ↓
fix Always explicitly set host=PRD_ENV in production: grabfood.Configuration(host=PRD_ENV). Import PRD_ENV from grabfood.configs.config.
gotcha OAuth tokens are not auto-refreshed. The SDK returns expires_in in the token response but does not implement token refresh logic. In long-running services, tokens expire and API calls begin returning 401 errors. ↓
fix Implement token refresh logic using expires_in: store the token issue time, check expiry before each request, and re-authenticate when expired.
gotcha This SDK covers GrabFood (food delivery merchant API) only. There is no official Python SDK for Grab rides, GrabPay, or GrabExpress. Attempting to call non-GrabFood endpoints with this SDK will fail. ↓
fix For non-GrabFood Grab APIs, use direct HTTP requests against the Grab Partner API with manual OAuth handling.
gotcha SDK is auto-generated from OpenAPI spec (PythonClientCodegen). The SDK is geographically scoped — GrabFood operates in Singapore, Malaysia, Indonesia, Thailand, Vietnam, Philippines, Cambodia, and Myanmar. Merchant IDs and API behavior may vary by country. ↓
fix Verify merchant country scope with Grab during onboarding. Staging environment covers all markets.
Install compatibility stale last tested: 2026-05-12
python os / libc status wheel install import disk
3.10 alpine (musl) - - - -
3.10 slim (glibc) - - - -
3.11 alpine (musl) - - - -
3.11 slim (glibc) - - - -
3.12 alpine (musl) - - - -
3.12 slim (glibc) - - - -
3.13 alpine (musl) - - - -
3.13 slim (glibc) - - - -
3.9 alpine (musl) - - - -
3.9 slim (glibc) - - - -
Imports
- grabfood wrong
import grabcorrectimport grabfood
Quickstart stale last tested: 2026-05-11
import grabfood
from grabfood.configs.config import STG_ENV, PRD_ENV, STG_AUTH_ENV, PRD_AUTH_ENV
from grabfood.rest import ApiException
# Step 1: Get OAuth token (client credentials flow)
# Credentials obtained from Grab Developer Portal
CLIENT_ID = 'your_client_id'
CLIENT_SECRET = 'your_client_secret'
# Auth configuration — use STG_AUTH_ENV for staging, PRD_AUTH_ENV for production
auth_config = grabfood.Configuration(host=STG_AUTH_ENV)
with grabfood.ApiClient(auth_config) as auth_client:
auth_api = grabfood.GetOauthGrabApi(auth_client)
oauth_request = grabfood.GrabOauthRequest(
client_id=CLIENT_ID,
client_secret=CLIENT_SECRET,
grant_type='client_credentials',
scope='food.partner_api'
)
token_response = auth_api.get_oauth_grab('application/json', oauth_request)
ACCESS_TOKEN = 'Bearer ' + token_response.access_token
# Store token_response.expires_in to know when to refresh
# Step 2: Use token against GrabFood API
# IMPORTANT: Default host is STG_ENV (sandbox). Switch to PRD_ENV for production.
configuration = grabfood.Configuration(host=PRD_ENV) # or STG_ENV for testing
MERCHANT_ID = 'your_merchant_id'
with grabfood.ApiClient(configuration) as api_client:
# Get store hours
store_api = grabfood.GetStoreHourApi(api_client)
try:
response = store_api.get_store_hour(
authorization=ACCESS_TOKEN,
merchant_id=MERCHANT_ID
)
print(response)
except ApiException as e:
print(f'API error: {e}')
# Accept an order
order_api = grabfood.AcceptRejectOrderApi(api_client)
try:
order_api.accept_reject_order(
authorization=ACCESS_TOKEN,
content_type='application/json',
accept_order_request=grabfood.AcceptOrderRequest()
)
except ApiException as e:
print(f'Order error: {e}')