# /guess-shape

## Suggest a Shape for a Document

<mark style="color:green;">`POST`</mark> `https://waveline.ai/api/v1/guess-shape`

Automatically generates a suggested shape for the data in a file, which can be used for the `shape` parameter in the [`/extract-document`](/extract/endpoints/extract-document.md) endpoint.

#### Headers

| Name                                            | Type   | Description                   |
| ----------------------------------------------- | ------ | ----------------------------- |
| Content-Type                                    | String | Should be `application/json`. |
| Authorization<mark style="color:red;">\*</mark> | String | `Bearer <YOUR_API_KEY>`       |

#### Request Body

| Name                                          | Type   | Description                                                                                                                                                                                                                                                                                                                             |
| --------------------------------------------- | ------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| fileName<mark style="color:red;">\*</mark>    | String | The name of the file. The suffix may be used by the AI for smarter extraction.                                                                                                                                                                                                                                                          |
| contentType<mark style="color:red;">\*</mark> | String | MIME type of the file, such as `text/text` or `application/pdf`.                                                                                                                                                                                                                                                                        |
| base64Content                                 | String | <p><span data-gb-custom-inline data-tag="emoji" data-code="26a0">⚠️</span> <strong>Only provide one of the three content properties.</strong><br><br>A string containing a base64 representation of the document to process.</p><p></p><p>Only accepts file sizes under 4.5MB, please use <code>contentUrl</code> for larger files.</p> |
| contentUrl                                    | String | <p><span data-gb-custom-inline data-tag="emoji" data-code="26a0">⚠️</span> <strong>Only provide one of the three content properties.</strong><br><br>A URL pointing to your data. (e.g. <https://example.com/invoice.pdf>)</p>                                                                                                          |
| textContent                                   | String | <p><span data-gb-custom-inline data-tag="emoji" data-code="26a0">⚠️</span> <strong>Only provide one of the three content properties.</strong></p><p></p><p>A string containing the paintext contents to process.</p>                                                                                                                    |

{% tabs %}
{% tab title="201: Created The job has been successfully created." %}

```typescript
{
    "id": string,
    "createdAt": string,
    "status": "CREATED",
    "type": "guess-shape",
    "pages": number, // Number of billed pages in this job
    "fileName": string,
    "result": null, // Is null after creation
    "urls": {
        "get": string; // Query this URL to get the status/result of your job
    }
}
```

{% endtab %}

{% tab title="400: Bad Request Missing body, wrong structure, ..." %}

<pre class="language-typescript"><code class="lang-typescript">{
<strong>    "error": string
</strong>}
</code></pre>

{% endtab %}

{% tab title="401: Unauthorized Provided API key is not valid." %}

<pre class="language-typescript"><code class="lang-typescript">{
<strong>    "error": string
</strong>}
</code></pre>

{% endtab %}

{% tab title="500: Internal Server Error An internal server error on our side happened. Please report to <team@waveline.ai> if this happens." %}

<pre class="language-typescript"><code class="lang-typescript">{
<strong>    "error": string
</strong>}
</code></pre>

{% endtab %}

{% tab title="402: Payment Required Your account is missing a billing method." %}

<pre class="language-typescript"><code class="lang-typescript">{
<strong>    "error": string
</strong>}
</code></pre>

{% endtab %}
{% endtabs %}

## Example

Here's an example of a JSON payload for the `guess-shape` endpoint:

```json
{
  "fileName": "example.pdf",
  "contentType": "application/pdf",
  "base64Content": "JVBERi0xLjMKMSAwIG9iago8PC9UeXBlL0NhdGF..."
}
```

In this example, we're requesting the API to generate a suggested shape for a PDF file.

To send this payload to the `guess-shape` endpoint using the `curl` command:

```bash
curl -X POST "https://waveline.ai/api/v1/guess-shape" \
     -H "Content-Type: application/json" \
     -H "Authorization: Bearer YOUR_API_KEY" \
     -d '{ ... JSON payload here ... }'
```

If you already have an account, you can [get an API key here](https://waveline.ai/extract/dashboard/api-keys).&#x20;


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.waveline.ai/extract/endpoints/guess-shape.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
