stract-api 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (114) hide show
  1. stract_api-0.1.0/LICENSE +21 -0
  2. stract_api-0.1.0/PKG-INFO +266 -0
  3. stract_api-0.1.0/README.md +246 -0
  4. stract_api-0.1.0/pyproject.toml +94 -0
  5. stract_api-0.1.0/setup.cfg +7 -0
  6. stract_api-0.1.0/setup.py +49 -0
  7. stract_api-0.1.0/stract_api/__init__.py +141 -0
  8. stract_api-0.1.0/stract_api/api/__init__.py +16 -0
  9. stract_api-0.1.0/stract_api/api/account_api.py +1098 -0
  10. stract_api-0.1.0/stract_api/api/account_credit_ledger_api.py +286 -0
  11. stract_api-0.1.0/stract_api/api/api_key_api.py +286 -0
  12. stract_api-0.1.0/stract_api/api/catalog_api.py +837 -0
  13. stract_api-0.1.0/stract_api/api/credits_api.py +534 -0
  14. stract_api-0.1.0/stract_api/api/document_api.py +2799 -0
  15. stract_api-0.1.0/stract_api/api/field_api.py +1168 -0
  16. stract_api-0.1.0/stract_api/api/job_api.py +2857 -0
  17. stract_api-0.1.0/stract_api/api/job_document_api.py +575 -0
  18. stract_api-0.1.0/stract_api/api/llm_model_api.py +286 -0
  19. stract_api-0.1.0/stract_api/api/struct_api.py +837 -0
  20. stract_api-0.1.0/stract_api/api/user_api.py +572 -0
  21. stract_api-0.1.0/stract_api/api_client.py +866 -0
  22. stract_api-0.1.0/stract_api/api_response.py +21 -0
  23. stract_api-0.1.0/stract_api/configuration.py +655 -0
  24. stract_api-0.1.0/stract_api/exceptions.py +219 -0
  25. stract_api-0.1.0/stract_api/models/__init__.py +52 -0
  26. stract_api-0.1.0/stract_api/models/account.py +130 -0
  27. stract_api-0.1.0/stract_api/models/account_credit_cache.py +112 -0
  28. stract_api-0.1.0/stract_api/models/account_credit_ledger.py +125 -0
  29. stract_api-0.1.0/stract_api/models/account_user.py +104 -0
  30. stract_api-0.1.0/stract_api/models/account_user_role.py +38 -0
  31. stract_api-0.1.0/stract_api/models/api_key.py +102 -0
  32. stract_api-0.1.0/stract_api/models/catalog.py +100 -0
  33. stract_api-0.1.0/stract_api/models/create_account_user_request.py +97 -0
  34. stract_api-0.1.0/stract_api/models/create_catalog_request.py +90 -0
  35. stract_api-0.1.0/stract_api/models/create_field_request.py +102 -0
  36. stract_api-0.1.0/stract_api/models/create_job_request.py +109 -0
  37. stract_api-0.1.0/stract_api/models/create_struct_request.py +90 -0
  38. stract_api-0.1.0/stract_api/models/deleted_document.py +91 -0
  39. stract_api-0.1.0/stract_api/models/deleted_field.py +91 -0
  40. stract_api-0.1.0/stract_api/models/document.py +107 -0
  41. stract_api-0.1.0/stract_api/models/document_link.py +90 -0
  42. stract_api-0.1.0/stract_api/models/document_processing_status.py +39 -0
  43. stract_api-0.1.0/stract_api/models/document_text.py +95 -0
  44. stract_api-0.1.0/stract_api/models/edit_account_request.py +90 -0
  45. stract_api-0.1.0/stract_api/models/edit_field_request.py +102 -0
  46. stract_api-0.1.0/stract_api/models/edit_my_user_request.py +92 -0
  47. stract_api-0.1.0/stract_api/models/field_type.py +42 -0
  48. stract_api-0.1.0/stract_api/models/job.py +129 -0
  49. stract_api-0.1.0/stract_api/models/job_document.py +123 -0
  50. stract_api-0.1.0/stract_api/models/job_output.py +98 -0
  51. stract_api-0.1.0/stract_api/models/job_output_record.py +103 -0
  52. stract_api-0.1.0/stract_api/models/job_status.py +41 -0
  53. stract_api-0.1.0/stract_api/models/llm_model.py +126 -0
  54. stract_api-0.1.0/stract_api/models/login_request.py +92 -0
  55. stract_api-0.1.0/stract_api/models/login_response.py +90 -0
  56. stract_api-0.1.0/stract_api/models/model_field.py +110 -0
  57. stract_api-0.1.0/stract_api/models/struct.py +100 -0
  58. stract_api-0.1.0/stract_api/models/sync_text_job_request.py +118 -0
  59. stract_api-0.1.0/stract_api/models/upload_text_document_request.py +93 -0
  60. stract_api-0.1.0/stract_api/models/user.py +102 -0
  61. stract_api-0.1.0/stract_api/py.typed +0 -0
  62. stract_api-0.1.0/stract_api/rest.py +335 -0
  63. stract_api-0.1.0/stract_api.egg-info/PKG-INFO +266 -0
  64. stract_api-0.1.0/stract_api.egg-info/SOURCES.txt +113 -0
  65. stract_api-0.1.0/stract_api.egg-info/dependency_links.txt +1 -0
  66. stract_api-0.1.0/stract_api.egg-info/requires.txt +4 -0
  67. stract_api-0.1.0/stract_api.egg-info/top_level.txt +1 -0
  68. stract_api-0.1.0/test/test_account.py +65 -0
  69. stract_api-0.1.0/test/test_account_api.py +60 -0
  70. stract_api-0.1.0/test/test_account_credit_cache.py +59 -0
  71. stract_api-0.1.0/test/test_account_credit_ledger.py +70 -0
  72. stract_api-0.1.0/test/test_account_credit_ledger_api.py +39 -0
  73. stract_api-0.1.0/test/test_account_user.py +65 -0
  74. stract_api-0.1.0/test/test_account_user_role.py +34 -0
  75. stract_api-0.1.0/test/test_api_key.py +63 -0
  76. stract_api-0.1.0/test/test_api_key_api.py +39 -0
  77. stract_api-0.1.0/test/test_catalog.py +61 -0
  78. stract_api-0.1.0/test/test_catalog_api.py +53 -0
  79. stract_api-0.1.0/test/test_create_account_user_request.py +59 -0
  80. stract_api-0.1.0/test/test_create_catalog_request.py +53 -0
  81. stract_api-0.1.0/test/test_create_field_request.py +60 -0
  82. stract_api-0.1.0/test/test_create_job_request.py +59 -0
  83. stract_api-0.1.0/test/test_create_struct_request.py +53 -0
  84. stract_api-0.1.0/test/test_credits_api.py +46 -0
  85. stract_api-0.1.0/test/test_deleted_document.py +53 -0
  86. stract_api-0.1.0/test/test_deleted_field.py +53 -0
  87. stract_api-0.1.0/test/test_document.py +66 -0
  88. stract_api-0.1.0/test/test_document_api.py +102 -0
  89. stract_api-0.1.0/test/test_document_link.py +53 -0
  90. stract_api-0.1.0/test/test_document_processing_status.py +34 -0
  91. stract_api-0.1.0/test/test_document_text.py +53 -0
  92. stract_api-0.1.0/test/test_edit_account_request.py +53 -0
  93. stract_api-0.1.0/test/test_edit_field_request.py +57 -0
  94. stract_api-0.1.0/test/test_edit_my_user_request.py +53 -0
  95. stract_api-0.1.0/test/test_field_api.py +60 -0
  96. stract_api-0.1.0/test/test_field_type.py +34 -0
  97. stract_api-0.1.0/test/test_job.py +73 -0
  98. stract_api-0.1.0/test/test_job_api.py +102 -0
  99. stract_api-0.1.0/test/test_job_document.py +68 -0
  100. stract_api-0.1.0/test/test_job_document_api.py +46 -0
  101. stract_api-0.1.0/test/test_job_output.py +59 -0
  102. stract_api-0.1.0/test/test_job_output_record.py +53 -0
  103. stract_api-0.1.0/test/test_job_status.py +34 -0
  104. stract_api-0.1.0/test/test_llm_model.py +69 -0
  105. stract_api-0.1.0/test/test_llm_model_api.py +39 -0
  106. stract_api-0.1.0/test/test_login_request.py +55 -0
  107. stract_api-0.1.0/test/test_login_response.py +53 -0
  108. stract_api-0.1.0/test/test_model_field.py +66 -0
  109. stract_api-0.1.0/test/test_struct.py +61 -0
  110. stract_api-0.1.0/test/test_struct_api.py +53 -0
  111. stract_api-0.1.0/test/test_sync_text_job_request.py +61 -0
  112. stract_api-0.1.0/test/test_upload_text_document_request.py +55 -0
  113. stract_api-0.1.0/test/test_user.py +63 -0
  114. stract_api-0.1.0/test/test_user_api.py +46 -0
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Stract API
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,266 @@
1
+ Metadata-Version: 2.4
2
+ Name: stract_api
3
+ Version: 0.1.0
4
+ Summary: Stract API
5
+ Home-page:
6
+ Author: Matt
7
+ Author-email: Matt <matt@stract-api.com>
8
+ License: MIT
9
+ Project-URL: Repository, https://github.com/mattpmoreno/stract-api-python
10
+ Keywords: OpenAPI,OpenAPI-Generator,Stract API
11
+ Requires-Python: >=3.11
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: urllib3<3.0.0,>=2.7.0
15
+ Requires-Dist: python-dateutil>=2.8.2
16
+ Requires-Dist: pydantic>=2.11
17
+ Requires-Dist: typing-extensions>=4.7.1
18
+ Dynamic: author
19
+ Dynamic: license-file
20
+
21
+ # stract-api-python
22
+ Get structured output from unstructured inputs
23
+
24
+ ## Machine authentication
25
+
26
+ Programmatic access to the API is authenticated with an API key. Include the API key in every request as a bearer token in the `authorization` header:
27
+
28
+ ```
29
+ authorization: bearer [apiKey]
30
+ ```
31
+
32
+ ## SDKs
33
+
34
+ Official SDKs are available for the following languages:
35
+
36
+ - **Node (JavaScript / TypeScript)**: [`stract-api` on npm](https://www.npmjs.com/package/stract-api)
37
+ - **Java (17+)**: [`com.stract-api:stract-api` on Maven Central](https://central.sonatype.com/artifact/com.stract-api/stract-api)
38
+
39
+
40
+ This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
41
+
42
+ - API version: 0.9.4
43
+ - Package version: 0.1.0
44
+ - Generator version: 7.27.0
45
+ - Build package: org.openapitools.codegen.languages.PythonClientCodegen
46
+
47
+ ## Requirements.
48
+
49
+ Python 3.11+
50
+
51
+ Packaging uses standard `[project]` metadata and `[dependency-groups]` (PEP 621/735).
52
+ Install the package with `python -m pip install .`; install development dependencies
53
+ with Poetry 2.2 or newer using `poetry install`, or pip 25.1 or newer using
54
+ `python -m pip install --group dev`. The latter installs the group, not the package.
55
+
56
+ ## Installation & Usage
57
+ ### pip install
58
+
59
+ If the python package is hosted on a repository, you can install directly using:
60
+
61
+ ```sh
62
+ pip install git+https://github.com/mattpmoreno/stract-api-python.git
63
+ ```
64
+ (you may need to run `pip` with root permission: `sudo pip install git+https://github.com/mattpmoreno/stract-api-python.git`)
65
+
66
+ Then import the package:
67
+ ```python
68
+ import stract_api
69
+ ```
70
+
71
+ ### Setuptools
72
+
73
+ Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
74
+
75
+ ```sh
76
+ python setup.py install --user
77
+ ```
78
+ (or `sudo python setup.py install` to install the package for all users)
79
+
80
+ Then import the package:
81
+ ```python
82
+ import stract_api
83
+ ```
84
+
85
+ ### Tests
86
+
87
+ Execute `pytest` to run the tests.
88
+
89
+ ## Getting Started
90
+
91
+ Please follow the [installation procedure](#installation--usage) and then run the following:
92
+
93
+ ```python
94
+
95
+ import stract_api
96
+ from stract_api.rest import ApiException
97
+ from pprint import pprint
98
+
99
+ # Defining the host is optional and defaults to https://api.stract-api.com
100
+ # See configuration.py for a list of all supported configuration parameters.
101
+ configuration = stract_api.Configuration(
102
+ host = "https://api.stract-api.com"
103
+ )
104
+
105
+ # The client must configure the authentication and authorization parameters
106
+ # in accordance with the API server security policy.
107
+ # Examples for each auth method are provided below, use the example that
108
+ # satisfies your auth use case.
109
+
110
+ # Configure Bearer authorization: bearerAuth
111
+ configuration = stract_api.Configuration(
112
+ access_token = os.environ["BEARER_TOKEN"]
113
+ )
114
+
115
+
116
+ # Enter a context with an instance of the API client
117
+ with stract_api.ApiClient(configuration) as api_client:
118
+ # Create an instance of the API class
119
+ api_instance = stract_api.AccountApi(api_client)
120
+ create_account_user_request = stract_api.CreateAccountUserRequest() # CreateAccountUserRequest |
121
+
122
+ try:
123
+ # Add a user to the current account
124
+ api_response = api_instance.create_account_user(create_account_user_request)
125
+ print("The response of AccountApi->create_account_user:\n")
126
+ pprint(api_response)
127
+ except ApiException as e:
128
+ print("Exception when calling AccountApi->create_account_user: %s\n" % e)
129
+
130
+ ```
131
+
132
+ ## Documentation for API Endpoints
133
+
134
+ All URIs are relative to *https://api.stract-api.com*
135
+
136
+ Class | Method | HTTP request | Description
137
+ ------------ | ------------- | ------------- | -------------
138
+ *AccountApi* | [**create_account_user**](docs/AccountApi.md#create_account_user) | **POST** /account/user | Add a user to the current account
139
+ *AccountApi* | [**edit_account**](docs/AccountApi.md#edit_account) | **PUT** /account | Edit the current account
140
+ *AccountApi* | [**get_account**](docs/AccountApi.md#get_account) | **GET** /account | Get information about user&#39;s account
141
+ *AccountApi* | [**get_account_users**](docs/AccountApi.md#get_account_users) | **GET** /account/user | Get the users in the current account
142
+ *AccountCreditLedgerApi* | [**get_account_credit_ledger_for_spending_user**](docs/AccountCreditLedgerApi.md#get_account_credit_ledger_for_spending_user) | **GET** /account_credit_ledger | Get the account credit ledger
143
+ *ApiKeyApi* | [**get_api_keys**](docs/ApiKeyApi.md#get_api_keys) | **GET** /api-key | Get the current account&#39;s API keys
144
+ *CatalogApi* | [**create_catalog**](docs/CatalogApi.md#create_catalog) | **POST** /catalog | Create a catalog
145
+ *CatalogApi* | [**delete_catalog**](docs/CatalogApi.md#delete_catalog) | **DELETE** /catalog/{catalogId} | Delete a catalog
146
+ *CatalogApi* | [**get_catalogs**](docs/CatalogApi.md#get_catalogs) | **GET** /catalog | Get all catalogs
147
+ *CreditsApi* | [**get_current_credits**](docs/CreditsApi.md#get_current_credits) | **GET** /current_credits | Get the current credit balance
148
+ *CreditsApi* | [**get_current_org_credits**](docs/CreditsApi.md#get_current_org_credits) | **GET** /current_org_credits | Get the current organization credit balance
149
+ *DocumentApi* | [**delete_document**](docs/DocumentApi.md#delete_document) | **DELETE** /document/{documentId} | Delete a document
150
+ *DocumentApi* | [**get_catalog_documents**](docs/DocumentApi.md#get_catalog_documents) | **GET** /catalog/{catalogId}/document | Get documents for a catalog
151
+ *DocumentApi* | [**get_document_link**](docs/DocumentApi.md#get_document_link) | **GET** /document/{documentId}/link | Get a link to a document
152
+ *DocumentApi* | [**get_document_text**](docs/DocumentApi.md#get_document_text) | **GET** /catalog/{catalogId}/document/{documentId}/text | Get the extracted text of a document
153
+ *DocumentApi* | [**get_documents_for_job**](docs/DocumentApi.md#get_documents_for_job) | **GET** /job/{jobId}/document | Get the documents for a job
154
+ *DocumentApi* | [**get_user_documents**](docs/DocumentApi.md#get_user_documents) | **GET** /document | Get all documents for the user
155
+ *DocumentApi* | [**upload_document**](docs/DocumentApi.md#upload_document) | **POST** /catalog/{catalogId}/document | Upload a file to the specified catalog
156
+ *DocumentApi* | [**upload_document_no_catalog**](docs/DocumentApi.md#upload_document_no_catalog) | **POST** /document | Upload a document
157
+ *DocumentApi* | [**upload_text_document**](docs/DocumentApi.md#upload_text_document) | **POST** /catalog/{catalogId}/document/text | Upload text as a document to the specified catalog
158
+ *DocumentApi* | [**upload_text_document_no_catalog**](docs/DocumentApi.md#upload_text_document_no_catalog) | **POST** /document/text | Upload text as a document
159
+ *FieldApi* | [**create_fields**](docs/FieldApi.md#create_fields) | **POST** /struct/{structId}/field | Create fields for a struct
160
+ *FieldApi* | [**delete_field**](docs/FieldApi.md#delete_field) | **DELETE** /field/{fieldId} | Delete a field
161
+ *FieldApi* | [**edit_field**](docs/FieldApi.md#edit_field) | **PUT** /field/{fieldId} | Edit a field
162
+ *FieldApi* | [**get_fields**](docs/FieldApi.md#get_fields) | **GET** /struct/{structId}/field | Get data fields for a struct
163
+ *JobApi* | [**archive_job**](docs/JobApi.md#archive_job) | **POST** /job/{jobId}/archive | Archive a job
164
+ *JobApi* | [**cancel_job**](docs/JobApi.md#cancel_job) | **POST** /job/{jobId}/cancel | Cancel a job
165
+ *JobApi* | [**create_job**](docs/JobApi.md#create_job) | **POST** /struct/{structId}/job | Create a job
166
+ *JobApi* | [**get_job_by_id**](docs/JobApi.md#get_job_by_id) | **GET** /job/{jobId} | Get a job by ID
167
+ *JobApi* | [**get_job_output_csv**](docs/JobApi.md#get_job_output_csv) | **GET** /job/{jobId}/output_csv | Get the output for a job as CSV
168
+ *JobApi* | [**get_job_output_json**](docs/JobApi.md#get_job_output_json) | **GET** /job/{jobId}/output_json | Get the output for a job as JSON
169
+ *JobApi* | [**get_struct_jobs**](docs/JobApi.md#get_struct_jobs) | **GET** /struct/{structId}/job | Get all jobs for the specified struct
170
+ *JobApi* | [**get_user_jobs**](docs/JobApi.md#get_user_jobs) | **GET** /job | Get all jobs for the user
171
+ *JobApi* | [**upload_document_process_and_run_job**](docs/JobApi.md#upload_document_process_and_run_job) | **POST** /struct/{structId}/job/sync | Upload a document, run an analysis job on that document, and download the output. For API use.
172
+ *JobApi* | [**upload_text_document_and_run_job**](docs/JobApi.md#upload_text_document_and_run_job) | **POST** /struct/{structId}/job/sync/text | Create a document from text, run an analysis job on that document, and download the output. For API use.
173
+ *JobDocumentApi* | [**get_job_document_output**](docs/JobDocumentApi.md#get_job_document_output) | **GET** /job_document/{jobDocId}/output | Get the output for a job document
174
+ *JobDocumentApi* | [**get_job_documents**](docs/JobDocumentApi.md#get_job_documents) | **GET** /job/{jobId}/job_document | Get the status of document analysis in a job
175
+ *LlmModelApi* | [**get_llm_models**](docs/LlmModelApi.md#get_llm_models) | **GET** /llm_model | Get the available LLM models
176
+ *StructApi* | [**archive_struct**](docs/StructApi.md#archive_struct) | **POST** /struct/{structId}/archive | Archive a struct
177
+ *StructApi* | [**create_struct**](docs/StructApi.md#create_struct) | **POST** /struct | Create a new data structure
178
+ *StructApi* | [**get_structs**](docs/StructApi.md#get_structs) | **GET** /struct | Get all data structures
179
+ *UserApi* | [**edit_my_user**](docs/UserApi.md#edit_my_user) | **PUT** /my_user | Edit the current user
180
+ *UserApi* | [**get_my_user**](docs/UserApi.md#get_my_user) | **GET** /my_user | Get the current user
181
+
182
+
183
+ ## Documentation For Models
184
+
185
+ - [Account](docs/Account.md)
186
+ - [AccountCreditCache](docs/AccountCreditCache.md)
187
+ - [AccountCreditLedger](docs/AccountCreditLedger.md)
188
+ - [AccountUser](docs/AccountUser.md)
189
+ - [AccountUserRole](docs/AccountUserRole.md)
190
+ - [ApiKey](docs/ApiKey.md)
191
+ - [Catalog](docs/Catalog.md)
192
+ - [CreateAccountUserRequest](docs/CreateAccountUserRequest.md)
193
+ - [CreateCatalogRequest](docs/CreateCatalogRequest.md)
194
+ - [CreateFieldRequest](docs/CreateFieldRequest.md)
195
+ - [CreateJobRequest](docs/CreateJobRequest.md)
196
+ - [CreateStructRequest](docs/CreateStructRequest.md)
197
+ - [DeletedDocument](docs/DeletedDocument.md)
198
+ - [DeletedField](docs/DeletedField.md)
199
+ - [Document](docs/Document.md)
200
+ - [DocumentLink](docs/DocumentLink.md)
201
+ - [DocumentProcessingStatus](docs/DocumentProcessingStatus.md)
202
+ - [DocumentText](docs/DocumentText.md)
203
+ - [EditAccountRequest](docs/EditAccountRequest.md)
204
+ - [EditFieldRequest](docs/EditFieldRequest.md)
205
+ - [EditMyUserRequest](docs/EditMyUserRequest.md)
206
+ - [FieldType](docs/FieldType.md)
207
+ - [Job](docs/Job.md)
208
+ - [JobDocument](docs/JobDocument.md)
209
+ - [JobOutput](docs/JobOutput.md)
210
+ - [JobOutputRecord](docs/JobOutputRecord.md)
211
+ - [JobStatus](docs/JobStatus.md)
212
+ - [LlmModel](docs/LlmModel.md)
213
+ - [LoginRequest](docs/LoginRequest.md)
214
+ - [LoginResponse](docs/LoginResponse.md)
215
+ - [ModelField](docs/ModelField.md)
216
+ - [Struct](docs/Struct.md)
217
+ - [SyncTextJobRequest](docs/SyncTextJobRequest.md)
218
+ - [UploadTextDocumentRequest](docs/UploadTextDocumentRequest.md)
219
+ - [User](docs/User.md)
220
+
221
+
222
+ <a id="documentation-for-authorization"></a>
223
+ ## Documentation For Authorization
224
+
225
+
226
+ Authentication schemes defined for the API:
227
+ <a id="bearerAuth"></a>
228
+ ### bearerAuth
229
+
230
+ - **Type**: Bearer authentication
231
+
232
+
233
+ ## Author
234
+
235
+ matt@stract-api.com
236
+
237
+
238
+ ## Request headers
239
+
240
+ Header names are compared case-insensitively in all Python client libraries.
241
+ Request headers are copied; supplying `_headers` does not change the caller's dict
242
+ or the client's shared defaults. The public `_headers` argument retains its dict
243
+ validation and existing value serialization. Pydantic can coerce mappings such as HTTPX `Headers` to a dict,
244
+ combining repeated fields into a single value; `_headers` does not provide a
245
+ repeated-field or list-of-pairs API.
246
+
247
+ Precedence, from lowest to highest:
248
+
249
+ 1. `_headers` (within one dict, the last inserted case variant wins).
250
+ 2. Explicit OpenAPI header parameters and generated `Content-Type` (or `_content_type`).
251
+ Generated `Accept` is added only when neither `_headers` nor explicit header
252
+ parameters contain an `Accept` case variant.
253
+ 3. `ApiClient.default_headers` (including headers set with `set_default_header`).
254
+ 4. The client's `cookie` setting, for `Cookie`.
255
+ 5. Authentication headers. A non-empty `_request_auth` replaces configured
256
+ authentication for that call; `{}` retains configured authentication. Cookie
257
+ authentication appends to the selected `Cookie` value.
258
+
259
+ This retains the existing precedence for identically spelled names and extends it
260
+ to case variants. To override a generated content type, use `_content_type`;
261
+ client defaults still take precedence over it. The winning header's spelling and
262
+ value are retained for replacements. Cookie authentication uses the canonical
263
+ `Cookie` spelling and appends its value. Values containing legitimate
264
+ comma-separated lists are not split or deduplicated. This does not remove
265
+ duplicate values inside a header or change the handling of repeated fields
266
+ supplied directly to the transport.
@@ -0,0 +1,246 @@
1
+ # stract-api-python
2
+ Get structured output from unstructured inputs
3
+
4
+ ## Machine authentication
5
+
6
+ Programmatic access to the API is authenticated with an API key. Include the API key in every request as a bearer token in the `authorization` header:
7
+
8
+ ```
9
+ authorization: bearer [apiKey]
10
+ ```
11
+
12
+ ## SDKs
13
+
14
+ Official SDKs are available for the following languages:
15
+
16
+ - **Node (JavaScript / TypeScript)**: [`stract-api` on npm](https://www.npmjs.com/package/stract-api)
17
+ - **Java (17+)**: [`com.stract-api:stract-api` on Maven Central](https://central.sonatype.com/artifact/com.stract-api/stract-api)
18
+
19
+
20
+ This Python package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project:
21
+
22
+ - API version: 0.9.4
23
+ - Package version: 0.1.0
24
+ - Generator version: 7.27.0
25
+ - Build package: org.openapitools.codegen.languages.PythonClientCodegen
26
+
27
+ ## Requirements.
28
+
29
+ Python 3.11+
30
+
31
+ Packaging uses standard `[project]` metadata and `[dependency-groups]` (PEP 621/735).
32
+ Install the package with `python -m pip install .`; install development dependencies
33
+ with Poetry 2.2 or newer using `poetry install`, or pip 25.1 or newer using
34
+ `python -m pip install --group dev`. The latter installs the group, not the package.
35
+
36
+ ## Installation & Usage
37
+ ### pip install
38
+
39
+ If the python package is hosted on a repository, you can install directly using:
40
+
41
+ ```sh
42
+ pip install git+https://github.com/mattpmoreno/stract-api-python.git
43
+ ```
44
+ (you may need to run `pip` with root permission: `sudo pip install git+https://github.com/mattpmoreno/stract-api-python.git`)
45
+
46
+ Then import the package:
47
+ ```python
48
+ import stract_api
49
+ ```
50
+
51
+ ### Setuptools
52
+
53
+ Install via [Setuptools](http://pypi.python.org/pypi/setuptools).
54
+
55
+ ```sh
56
+ python setup.py install --user
57
+ ```
58
+ (or `sudo python setup.py install` to install the package for all users)
59
+
60
+ Then import the package:
61
+ ```python
62
+ import stract_api
63
+ ```
64
+
65
+ ### Tests
66
+
67
+ Execute `pytest` to run the tests.
68
+
69
+ ## Getting Started
70
+
71
+ Please follow the [installation procedure](#installation--usage) and then run the following:
72
+
73
+ ```python
74
+
75
+ import stract_api
76
+ from stract_api.rest import ApiException
77
+ from pprint import pprint
78
+
79
+ # Defining the host is optional and defaults to https://api.stract-api.com
80
+ # See configuration.py for a list of all supported configuration parameters.
81
+ configuration = stract_api.Configuration(
82
+ host = "https://api.stract-api.com"
83
+ )
84
+
85
+ # The client must configure the authentication and authorization parameters
86
+ # in accordance with the API server security policy.
87
+ # Examples for each auth method are provided below, use the example that
88
+ # satisfies your auth use case.
89
+
90
+ # Configure Bearer authorization: bearerAuth
91
+ configuration = stract_api.Configuration(
92
+ access_token = os.environ["BEARER_TOKEN"]
93
+ )
94
+
95
+
96
+ # Enter a context with an instance of the API client
97
+ with stract_api.ApiClient(configuration) as api_client:
98
+ # Create an instance of the API class
99
+ api_instance = stract_api.AccountApi(api_client)
100
+ create_account_user_request = stract_api.CreateAccountUserRequest() # CreateAccountUserRequest |
101
+
102
+ try:
103
+ # Add a user to the current account
104
+ api_response = api_instance.create_account_user(create_account_user_request)
105
+ print("The response of AccountApi->create_account_user:\n")
106
+ pprint(api_response)
107
+ except ApiException as e:
108
+ print("Exception when calling AccountApi->create_account_user: %s\n" % e)
109
+
110
+ ```
111
+
112
+ ## Documentation for API Endpoints
113
+
114
+ All URIs are relative to *https://api.stract-api.com*
115
+
116
+ Class | Method | HTTP request | Description
117
+ ------------ | ------------- | ------------- | -------------
118
+ *AccountApi* | [**create_account_user**](docs/AccountApi.md#create_account_user) | **POST** /account/user | Add a user to the current account
119
+ *AccountApi* | [**edit_account**](docs/AccountApi.md#edit_account) | **PUT** /account | Edit the current account
120
+ *AccountApi* | [**get_account**](docs/AccountApi.md#get_account) | **GET** /account | Get information about user&#39;s account
121
+ *AccountApi* | [**get_account_users**](docs/AccountApi.md#get_account_users) | **GET** /account/user | Get the users in the current account
122
+ *AccountCreditLedgerApi* | [**get_account_credit_ledger_for_spending_user**](docs/AccountCreditLedgerApi.md#get_account_credit_ledger_for_spending_user) | **GET** /account_credit_ledger | Get the account credit ledger
123
+ *ApiKeyApi* | [**get_api_keys**](docs/ApiKeyApi.md#get_api_keys) | **GET** /api-key | Get the current account&#39;s API keys
124
+ *CatalogApi* | [**create_catalog**](docs/CatalogApi.md#create_catalog) | **POST** /catalog | Create a catalog
125
+ *CatalogApi* | [**delete_catalog**](docs/CatalogApi.md#delete_catalog) | **DELETE** /catalog/{catalogId} | Delete a catalog
126
+ *CatalogApi* | [**get_catalogs**](docs/CatalogApi.md#get_catalogs) | **GET** /catalog | Get all catalogs
127
+ *CreditsApi* | [**get_current_credits**](docs/CreditsApi.md#get_current_credits) | **GET** /current_credits | Get the current credit balance
128
+ *CreditsApi* | [**get_current_org_credits**](docs/CreditsApi.md#get_current_org_credits) | **GET** /current_org_credits | Get the current organization credit balance
129
+ *DocumentApi* | [**delete_document**](docs/DocumentApi.md#delete_document) | **DELETE** /document/{documentId} | Delete a document
130
+ *DocumentApi* | [**get_catalog_documents**](docs/DocumentApi.md#get_catalog_documents) | **GET** /catalog/{catalogId}/document | Get documents for a catalog
131
+ *DocumentApi* | [**get_document_link**](docs/DocumentApi.md#get_document_link) | **GET** /document/{documentId}/link | Get a link to a document
132
+ *DocumentApi* | [**get_document_text**](docs/DocumentApi.md#get_document_text) | **GET** /catalog/{catalogId}/document/{documentId}/text | Get the extracted text of a document
133
+ *DocumentApi* | [**get_documents_for_job**](docs/DocumentApi.md#get_documents_for_job) | **GET** /job/{jobId}/document | Get the documents for a job
134
+ *DocumentApi* | [**get_user_documents**](docs/DocumentApi.md#get_user_documents) | **GET** /document | Get all documents for the user
135
+ *DocumentApi* | [**upload_document**](docs/DocumentApi.md#upload_document) | **POST** /catalog/{catalogId}/document | Upload a file to the specified catalog
136
+ *DocumentApi* | [**upload_document_no_catalog**](docs/DocumentApi.md#upload_document_no_catalog) | **POST** /document | Upload a document
137
+ *DocumentApi* | [**upload_text_document**](docs/DocumentApi.md#upload_text_document) | **POST** /catalog/{catalogId}/document/text | Upload text as a document to the specified catalog
138
+ *DocumentApi* | [**upload_text_document_no_catalog**](docs/DocumentApi.md#upload_text_document_no_catalog) | **POST** /document/text | Upload text as a document
139
+ *FieldApi* | [**create_fields**](docs/FieldApi.md#create_fields) | **POST** /struct/{structId}/field | Create fields for a struct
140
+ *FieldApi* | [**delete_field**](docs/FieldApi.md#delete_field) | **DELETE** /field/{fieldId} | Delete a field
141
+ *FieldApi* | [**edit_field**](docs/FieldApi.md#edit_field) | **PUT** /field/{fieldId} | Edit a field
142
+ *FieldApi* | [**get_fields**](docs/FieldApi.md#get_fields) | **GET** /struct/{structId}/field | Get data fields for a struct
143
+ *JobApi* | [**archive_job**](docs/JobApi.md#archive_job) | **POST** /job/{jobId}/archive | Archive a job
144
+ *JobApi* | [**cancel_job**](docs/JobApi.md#cancel_job) | **POST** /job/{jobId}/cancel | Cancel a job
145
+ *JobApi* | [**create_job**](docs/JobApi.md#create_job) | **POST** /struct/{structId}/job | Create a job
146
+ *JobApi* | [**get_job_by_id**](docs/JobApi.md#get_job_by_id) | **GET** /job/{jobId} | Get a job by ID
147
+ *JobApi* | [**get_job_output_csv**](docs/JobApi.md#get_job_output_csv) | **GET** /job/{jobId}/output_csv | Get the output for a job as CSV
148
+ *JobApi* | [**get_job_output_json**](docs/JobApi.md#get_job_output_json) | **GET** /job/{jobId}/output_json | Get the output for a job as JSON
149
+ *JobApi* | [**get_struct_jobs**](docs/JobApi.md#get_struct_jobs) | **GET** /struct/{structId}/job | Get all jobs for the specified struct
150
+ *JobApi* | [**get_user_jobs**](docs/JobApi.md#get_user_jobs) | **GET** /job | Get all jobs for the user
151
+ *JobApi* | [**upload_document_process_and_run_job**](docs/JobApi.md#upload_document_process_and_run_job) | **POST** /struct/{structId}/job/sync | Upload a document, run an analysis job on that document, and download the output. For API use.
152
+ *JobApi* | [**upload_text_document_and_run_job**](docs/JobApi.md#upload_text_document_and_run_job) | **POST** /struct/{structId}/job/sync/text | Create a document from text, run an analysis job on that document, and download the output. For API use.
153
+ *JobDocumentApi* | [**get_job_document_output**](docs/JobDocumentApi.md#get_job_document_output) | **GET** /job_document/{jobDocId}/output | Get the output for a job document
154
+ *JobDocumentApi* | [**get_job_documents**](docs/JobDocumentApi.md#get_job_documents) | **GET** /job/{jobId}/job_document | Get the status of document analysis in a job
155
+ *LlmModelApi* | [**get_llm_models**](docs/LlmModelApi.md#get_llm_models) | **GET** /llm_model | Get the available LLM models
156
+ *StructApi* | [**archive_struct**](docs/StructApi.md#archive_struct) | **POST** /struct/{structId}/archive | Archive a struct
157
+ *StructApi* | [**create_struct**](docs/StructApi.md#create_struct) | **POST** /struct | Create a new data structure
158
+ *StructApi* | [**get_structs**](docs/StructApi.md#get_structs) | **GET** /struct | Get all data structures
159
+ *UserApi* | [**edit_my_user**](docs/UserApi.md#edit_my_user) | **PUT** /my_user | Edit the current user
160
+ *UserApi* | [**get_my_user**](docs/UserApi.md#get_my_user) | **GET** /my_user | Get the current user
161
+
162
+
163
+ ## Documentation For Models
164
+
165
+ - [Account](docs/Account.md)
166
+ - [AccountCreditCache](docs/AccountCreditCache.md)
167
+ - [AccountCreditLedger](docs/AccountCreditLedger.md)
168
+ - [AccountUser](docs/AccountUser.md)
169
+ - [AccountUserRole](docs/AccountUserRole.md)
170
+ - [ApiKey](docs/ApiKey.md)
171
+ - [Catalog](docs/Catalog.md)
172
+ - [CreateAccountUserRequest](docs/CreateAccountUserRequest.md)
173
+ - [CreateCatalogRequest](docs/CreateCatalogRequest.md)
174
+ - [CreateFieldRequest](docs/CreateFieldRequest.md)
175
+ - [CreateJobRequest](docs/CreateJobRequest.md)
176
+ - [CreateStructRequest](docs/CreateStructRequest.md)
177
+ - [DeletedDocument](docs/DeletedDocument.md)
178
+ - [DeletedField](docs/DeletedField.md)
179
+ - [Document](docs/Document.md)
180
+ - [DocumentLink](docs/DocumentLink.md)
181
+ - [DocumentProcessingStatus](docs/DocumentProcessingStatus.md)
182
+ - [DocumentText](docs/DocumentText.md)
183
+ - [EditAccountRequest](docs/EditAccountRequest.md)
184
+ - [EditFieldRequest](docs/EditFieldRequest.md)
185
+ - [EditMyUserRequest](docs/EditMyUserRequest.md)
186
+ - [FieldType](docs/FieldType.md)
187
+ - [Job](docs/Job.md)
188
+ - [JobDocument](docs/JobDocument.md)
189
+ - [JobOutput](docs/JobOutput.md)
190
+ - [JobOutputRecord](docs/JobOutputRecord.md)
191
+ - [JobStatus](docs/JobStatus.md)
192
+ - [LlmModel](docs/LlmModel.md)
193
+ - [LoginRequest](docs/LoginRequest.md)
194
+ - [LoginResponse](docs/LoginResponse.md)
195
+ - [ModelField](docs/ModelField.md)
196
+ - [Struct](docs/Struct.md)
197
+ - [SyncTextJobRequest](docs/SyncTextJobRequest.md)
198
+ - [UploadTextDocumentRequest](docs/UploadTextDocumentRequest.md)
199
+ - [User](docs/User.md)
200
+
201
+
202
+ <a id="documentation-for-authorization"></a>
203
+ ## Documentation For Authorization
204
+
205
+
206
+ Authentication schemes defined for the API:
207
+ <a id="bearerAuth"></a>
208
+ ### bearerAuth
209
+
210
+ - **Type**: Bearer authentication
211
+
212
+
213
+ ## Author
214
+
215
+ matt@stract-api.com
216
+
217
+
218
+ ## Request headers
219
+
220
+ Header names are compared case-insensitively in all Python client libraries.
221
+ Request headers are copied; supplying `_headers` does not change the caller's dict
222
+ or the client's shared defaults. The public `_headers` argument retains its dict
223
+ validation and existing value serialization. Pydantic can coerce mappings such as HTTPX `Headers` to a dict,
224
+ combining repeated fields into a single value; `_headers` does not provide a
225
+ repeated-field or list-of-pairs API.
226
+
227
+ Precedence, from lowest to highest:
228
+
229
+ 1. `_headers` (within one dict, the last inserted case variant wins).
230
+ 2. Explicit OpenAPI header parameters and generated `Content-Type` (or `_content_type`).
231
+ Generated `Accept` is added only when neither `_headers` nor explicit header
232
+ parameters contain an `Accept` case variant.
233
+ 3. `ApiClient.default_headers` (including headers set with `set_default_header`).
234
+ 4. The client's `cookie` setting, for `Cookie`.
235
+ 5. Authentication headers. A non-empty `_request_auth` replaces configured
236
+ authentication for that call; `{}` retains configured authentication. Cookie
237
+ authentication appends to the selected `Cookie` value.
238
+
239
+ This retains the existing precedence for identically spelled names and extends it
240
+ to case variants. To override a generated content type, use `_content_type`;
241
+ client defaults still take precedence over it. The winning header's spelling and
242
+ value are retained for replacements. Cookie authentication uses the canonical
243
+ `Cookie` spelling and appends its value. Values containing legitimate
244
+ comma-separated lists are not split or deduplicated. This does not remove
245
+ duplicate values inside a header or change the handling of repeated fields
246
+ supplied directly to the transport.
@@ -0,0 +1,94 @@
1
+ [project]
2
+ name = "stract_api"
3
+ version = "0.1.0"
4
+ description = "Stract API"
5
+ authors = [
6
+ {name = "Matt",email = "matt@stract-api.com"},
7
+ ]
8
+ license = { text = "MIT" }
9
+ readme = "README.md"
10
+ keywords = ["OpenAPI", "OpenAPI-Generator", "Stract API"]
11
+ requires-python = ">=3.11"
12
+
13
+ dependencies = [
14
+ "urllib3 (>=2.7.0,<3.0.0)",
15
+ "python-dateutil (>=2.8.2)",
16
+ "pydantic (>=2.11)",
17
+ "typing-extensions (>=4.7.1)",
18
+ ]
19
+
20
+ [project.urls]
21
+ Repository = "https://github.com/mattpmoreno/stract-api-python"
22
+
23
+ [dependency-groups]
24
+ dev = [
25
+ "pytest>=9.0.3",
26
+ "pytest-cov>=2.8.1",
27
+ "tox>=3.9.0",
28
+ "flake8>=4.0.0",
29
+ "types-python-dateutil>=2.8.19.14",
30
+ "mypy>=1.5",
31
+ ]
32
+
33
+
34
+ [build-system]
35
+ requires = ["setuptools"]
36
+ build-backend = "setuptools.build_meta"
37
+
38
+ [tool.pylint.'MESSAGES CONTROL']
39
+ extension-pkg-whitelist = "pydantic"
40
+
41
+ [tool.mypy]
42
+ files = [
43
+ "stract_api",
44
+ #"test", # auto-generated tests
45
+ "tests", # hand-written tests
46
+ ]
47
+ # TODO: enable "strict" once all these individual checks are passing
48
+ # strict = true
49
+
50
+ # List from: https://mypy.readthedocs.io/en/stable/existing_code.html#introduce-stricter-options
51
+ warn_unused_configs = true
52
+ warn_redundant_casts = true
53
+ warn_unused_ignores = true
54
+
55
+ ## Getting these passing should be easy
56
+ strict_equality = true
57
+ extra_checks = true
58
+
59
+ ## Strongly recommend enabling this one as soon as you can
60
+ check_untyped_defs = true
61
+
62
+ ## These shouldn't be too much additional work, but may be tricky to
63
+ ## get passing if you use a lot of untyped libraries
64
+ disallow_subclassing_any = true
65
+ disallow_untyped_decorators = true
66
+ disallow_any_generics = true
67
+
68
+ ### These next few are various gradations of forcing use of type annotations
69
+ #disallow_untyped_calls = true
70
+ #disallow_incomplete_defs = true
71
+ #disallow_untyped_defs = true
72
+ #
73
+ ### This one isn't too hard to get passing, but return on investment is lower
74
+ #no_implicit_reexport = true
75
+ #
76
+ ### This one can be tricky to get passing if you use a lot of untyped libraries
77
+ #warn_return_any = true
78
+
79
+ [[tool.mypy.overrides]]
80
+ module = [
81
+ "stract_api.configuration",
82
+ ]
83
+ warn_unused_ignores = true
84
+ strict_equality = true
85
+ extra_checks = true
86
+ check_untyped_defs = true
87
+ disallow_subclassing_any = true
88
+ disallow_untyped_decorators = true
89
+ disallow_any_generics = true
90
+ disallow_untyped_calls = true
91
+ disallow_incomplete_defs = true
92
+ disallow_untyped_defs = true
93
+ no_implicit_reexport = true
94
+ warn_return_any = true
@@ -0,0 +1,7 @@
1
+ [flake8]
2
+ max-line-length = 99
3
+
4
+ [egg_info]
5
+ tag_build =
6
+ tag_date = 0
7
+