Skip to content

client.files

Documents you upload for a later request, such as a port’s signed LOA. These methods are on client.files, where client is a MoreVoice client (see the Python SDK). On AsyncMoreVoice the same methods are awaited. Each one returns the response object and raises an exception when the API answers with an error.

Upload a file. Uploads a document for a later request, as multipart/form-data (a file part and purpose) or as JSON with the file base64: a PDF, JPEG or PNG of up to 10 MB (the type is read from the file itself). Today’s purpose is port_document: the signed LOA and the latest invoice of a port (POST /v1/ports). The file is stored encrypted; a file is used by one request, and an unused one is deleted after 7 days. At most 50 unused files at a time. Needs a live key and number porting on.

client.files
def create(self, body: _m.FileCreateParamsInput | _m.FilesCreateFilesBody | Mapping[str, Any] | Unset = UNSET, *, more_voice_version: str | Unset = UNSET, idempotency_key: str | Unset = UNSET) -> _m.File

client.files.create() · await async_client.files.create() · POST /files · API reference

Field Type Required Description
purpose "port_document" yes What the file is for: port_document.
file object yes The document. JSON requests send it base64; multipart/form-data requests send a file part.

File:

Field Type Description
object "file" Always file.
id string A file ID (prefix file_).
livemode boolean true in live mode, false in test mode.
purpose "port_document" What the file is for: port_document (a port’s signed LOA or latest invoice).
filename string —
mime_type string application/pdf, image/jpeg or image/png (read from the file itself).
size_bytes integer —
sha256 string SHA-256 of the file’s bytes (hex).
used boolean A request took it (a file is used once).
expires_at string | null An unused file is deleted after this; null once used.
created string An ISO-8601 timestamp in UTC.
from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
file = client.files.create({
"file": {
"content_base64": "JVBERi0xLjQKJcfsj6IK",
"filename": "loa-signed.pdf",
},
"purpose": "port_document",
})
print(file)

Retrieve a file. An uploaded file’s facts (purpose, type, size, SHA-256, whether a request used it). The file itself is never returned.

client.files
def retrieve(self, id: str, *, more_voice_version: str | Unset = UNSET) -> _m.File

client.files.retrieve() · await async_client.files.retrieve() · GET /files/{id} · API reference

Name Type Required Description
id str yes A file ID (file_…).

File:

Field Type Description
object "file" Always file.
id string A file ID (prefix file_).
livemode boolean true in live mode, false in test mode.
purpose "port_document" What the file is for: port_document (a port’s signed LOA or latest invoice).
filename string —
mime_type string application/pdf, image/jpeg or image/png (read from the file itself).
size_bytes integer —
sha256 string SHA-256 of the file’s bytes (hex).
used boolean A request took it (a file is used once).
expires_at string | null An unused file is deleted after this; null once used.
created string An ISO-8601 timestamp in UTC.
from morevoice import MoreVoice
client = MoreVoice() # MOREVOICE_API_KEY from the environment
file = client.files.retrieve("file_7Hk2Lm9Qp")
print(file)