curl
Resources

API and SDK reference

Client SDKs

We offer native client SDKs in the following languages. Select a language to view documentation and usage examples for that language.

Python
TypeScript
Go
C#
Java

Installation


_10
pip install git+<UNSET>.git


Custom HTTP Client

The Python SDK makes API calls using the (requests)[https://pypi.org/project/requests/] HTTP library. In order to provide a convenient way to configure timeouts, cookies, proxies, custom headers, and other low-level configuration, you can initialize the SDK client with a custom requests.Session object.

For example, you could specify a header for every request that this sdk makes as follows:


_10
import sdk
_10
import requests
_10
_10
http_client = requests.Session()
_10
http_client.headers.update({'x-custom-header': 'someValue'})
_10
s = sdk.SDK(client: http_client)


Security Options

Per-Client Security Schemes

This SDK supports the following security scheme globally:

To authenticate with the API the api_key parameter must be set when initializing the SDK client instance. For example:


_14
import sdk
_14
from sdk.models import operations
_14
_14
s = sdk.SDK(
_14
api_key="<YOUR_API_KEY_HERE>",
_14
)
_14
_14
req = operations.AuthenticateRequestBody()
_14
_14
res = s.authentication.authenticate(req)
_14
_14
if res.object is not None:
_14
# handle response
_14
pass


Errors

Handling errors in this SDK should largely match your expectations. All operations return a response object or raise an error. If Error objects are specified in your OpenAPI Spec, the SDK will raise the appropriate Error type.

Example


_22
import sdk
_22
from sdk.models import operations
_22
_22
s = sdk.SDK(
_22
api_key="<YOUR_API_KEY_HERE>",
_22
)
_22
_22
req = operations.AuthenticateRequestBody()
_22
_22
res = None
_22
try:
_22
res = s.authentication.authenticate(req)
_22
except errors.APIError as e:
_22
print(e) # handle exception
_22
raise(e)
_22
except errors.SDKError as e:
_22
print(e) # handle exception
_22
raise(e)
_22
_22
if res.object is not None:
_22
# handle response
_22
pass


Server Options

Select Server by Name

You can override the default server globally by passing a server name to the server: str optional parameter when initializing the SDK client instance. The selected server will then be used as the default on the operations that use it. This table lists the names associated with the available servers:

Example


_15
import sdk
_15
from sdk.models import operations
_15
_15
s = sdk.SDK(
_15
server="customer",
_15
api_key="<YOUR_API_KEY_HERE>",
_15
)
_15
_15
req = operations.AuthenticateRequestBody()
_15
_15
res = s.authentication.authenticate(req)
_15
_15
if res.object is not None:
_15
# handle response
_15
pass

Variables

Some of the server options above contain variables. If you want to set the values of those variables, the following optional parameters are available when initializing the SDK client instance:

  • organization: str
  • environment: models.ServerEnvironment

Override Server URL Per-Client

The default server can also be overridden globally by passing a URL to the server_url: str optional parameter when initializing the SDK client instance. For example:


_15
import sdk
_15
from sdk.models import operations
_15
_15
s = sdk.SDK(
_15
server_url="https://speakeasy.bar",
_15
api_key="<YOUR_API_KEY_HERE>",
_15
)
_15
_15
req = operations.AuthenticateRequestBody()
_15
_15
res = s.authentication.authenticate(req)
_15
_15
if res.object is not None:
_15
# handle response
_15
pass


Authentication

The authentication endpoints.

Available Operations

  • Authenticate - Authenticate with the API by providing a username and password.

Authentication

Authenticate

Authenticate with the API by providing a username and password.

Parameters

Python
request operations.AuthenticateRequestBody

The request object to use for the request.

Show child properties
username Optional[str]

password Optional[str]

Response

Python
operations.AuthenticateResponse
Hide child properties
content_type str

HTTP response content type for this operation


status_code int

HTTP response status code for this operation


raw_response requests.Response

Raw HTTP response; suitable for custom response parsing


object Optional[operations.AuthenticateResponseBody]

The api key to use for authenticated endpoints.

Show child properties

error Optional[components.Error]

An unknown error occurred interacting with the API.

Show child properties
Authenticate.py

_14
import sdk
_14
from sdk.models import operations
_14
_14
s = sdk.SDK(
_14
api_key="<YOUR_API_KEY_HERE>",
_14
)
_14
_14
req = operations.AuthenticateRequestBody()
_14
_14
res = s.authentication.authenticate(req)
_14
_14
if res.object is not None:
_14
# handle response
_14
pass

Example Response

_10
{
_10
"code": "string",
_10
"message": "string",
_10
"details": {}
_10
}


Drinks

The drinks endpoints.

Available Operations


Drinks

List Drinks

Get a list of drinks, if authenticated this will include stock levels and product codes otherwise it will only include public information.

Parameters

Python
drink_type Optional[components.DrinkType]

The type of drink to filter by. If not provided all drinks will be returned.

Show child properties
NameValue
COCKTAILcocktail
NON_ALCOHOLICnon-alcoholic
BEERbeer
WINEwine
SPIRITspirit
OTHERother

Response

Python
operations.ListDrinksResponse
Hide child properties
content_type str

HTTP response content type for this operation


status_code int

HTTP response status code for this operation


raw_response requests.Response

Raw HTTP response; suitable for custom response parsing


classes List[components.Drink]

A list of drinks.

Show child properties

error Optional[components.Error]

An unknown error occurred interacting with the API.

Show child properties
ListDrinks.py

_11
import sdk
_11
from sdk.models import components, operations
_11
_11
s = sdk.SDK()
_11
_11
_11
res = s.drinks.list_drinks(drink_type=components.DrinkType.WINE)
_11
_11
if res.classes is not None:
_11
# handle response
_11
pass

Example Response

_10
{
_10
"code": "string",
_10
"message": "string",
_10
"details": {}
_10
}


Drinks

Get Drink

Get a drink by name, if authenticated this will include stock levels and product codes otherwise it will only include public information.

Parameters

Python
name str

Response

Python
operations.GetDrinkResponse
Hide child properties
content_type str

HTTP response content type for this operation


status_code int

HTTP response status code for this operation


raw_response requests.Response

Raw HTTP response; suitable for custom response parsing


drink Optional[components.Drink]

A drink.

Show child properties

error Optional[components.Error]

An unknown error occurred interacting with the API.

Show child properties
GetDrink.py

_13
import sdk
_13
from sdk.models import operations
_13
_13
s = sdk.SDK(
_13
api_key="<YOUR_API_KEY_HERE>",
_13
)
_13
_13
_13
res = s.drinks.get_drink(name='string')
_13
_13
if res.drink is not None:
_13
# handle response
_13
pass

Example Response

_10
{
_10
"code": "string",
_10
"message": "string",
_10
"details": {}
_10
}


Ingredients

The ingredients endpoints.

Available Operations


Ingredients

List Ingredients

Get a list of ingredients, if authenticated this will include stock levels and product codes otherwise it will only include public information.

Parameters

Python
ingredients List[*str*]

A list of ingredients to filter by. If not provided all ingredients will be returned.

Response

Python
operations.ListIngredientsResponse
Hide child properties
content_type str

HTTP response content type for this operation


status_code int

HTTP response status code for this operation


raw_response requests.Response

Raw HTTP response; suitable for custom response parsing


classes List[components.Ingredient]

A list of ingredients.

Show child properties

error Optional[components.Error]

An unknown error occurred interacting with the API.

Show child properties
ListIngredients.py

_15
import sdk
_15
from sdk.models import operations
_15
_15
s = sdk.SDK(
_15
api_key="<YOUR_API_KEY_HERE>",
_15
)
_15
_15
_15
res = s.ingredients.list_ingredients(ingredients=[
_15
'string',
_15
])
_15
_15
if res.classes is not None:
_15
# handle response
_15
pass

Example Response

_10
{
_10
"code": "string",
_10
"message": "string",
_10
"details": {}
_10
}


Orders

The orders endpoints.

Available Operations


Orders

Create Order

Create an order for a drink.

Parameters

Python
request_body List[components.OrderInput]
Show child properties
type components.OrderType

The type of order.

Show child properties

product_code str

The product code of the drink or ingredient.


Example: AC-A2DF3


quantity int

The number of units of the drink or ingredient to order.


callback_url Optional[str]

The url to call when the order is updated.

Response

Python
operations.CreateOrderResponse
Hide child properties
content_type str

HTTP response content type for this operation


status_code int

HTTP response status code for this operation


raw_response requests.Response

Raw HTTP response; suitable for custom response parsing


order Optional[components.Order]

The order was created successfully.

Show child properties

error Optional[components.Error]

An unknown error occurred interacting with the API.

Show child properties
CreateOrder.py

_19
import sdk
_19
from sdk.models import callbacks, components, operations
_19
_19
s = sdk.SDK(
_19
api_key="<YOUR_API_KEY_HERE>",
_19
)
_19
_19
_19
res = s.orders.create_order(request_body=[
_19
components.OrderInput(
_19
type=components.OrderType.INGREDIENT,
_19
product_code='APM-1F2D3',
_19
quantity=844266,
_19
),
_19
], callback_url='string')
_19
_19
if res.order is not None:
_19
# handle response
_19
pass

Example Response

_10
{
_10
"code": "string",
_10
"message": "string",
_10
"details": {}
_10
}


Config

Available Operations


Config

Subscribe To Webhooks

Subscribe to webhooks.

Parameters

Python
request List[operations.RequestBody]

The request object to use for the request.

Show child properties
url Optional[str]

webhook Optional[operations.Webhook]
Show child properties

Response

Python
operations.SubscribeToWebhooksResponse
Hide child properties
content_type str

HTTP response content type for this operation


status_code int

HTTP response status code for this operation


raw_response requests.Response

Raw HTTP response; suitable for custom response parsing


error Optional[components.Error]

An unknown error occurred interacting with the API.

Show child properties
SubscribeToWebhooks.py

_16
import sdk
_16
from sdk.models import operations
_16
_16
s = sdk.SDK(
_16
api_key="<YOUR_API_KEY_HERE>",
_16
)
_16
_16
req = [
_16
operations.RequestBody(),
_16
]
_16
_16
res = s.config.subscribe_to_webhooks(req)
_16
_16
if res.status_code == 200:
_16
# handle response
_16
pass

Example Response

_10
{
_10
"code": "string",
_10
"message": "string",
_10
"details": {}
_10
}