> ## Documentation Index
> Fetch the complete documentation index at: https://docs.invopop.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Import a format to GOBL

> Convert a document in an external format, such as UBL or CII, into a GOBL Envelope without persisting anything. Send the raw document as the request body; its format is detected automatically. Any files embedded in the document are returned as attachments. Requests up to 100MB are accepted.

Convert a document in an external format, such as a UBL or CII invoice, into a [GOBL Envelope](https://docs.gobl.org/draft-0/envelope) without storing anything. Send the raw document as the request body. Its format is detected automatically, and the response says which one was used.

Any files embedded in the document, such as a PDF copy of the invoice, are returned in `attachments` with their contents base64 encoded.

```bash theme={"system"}
curl -X POST "https://api.invopop.com/silo/v1/gobl/convert/import" \
  -H "Authorization: Bearer $INVOPOP_TOKEN" \
  -H "Content-Type: application/xml" \
  --data-binary @invoice.xml
```

To limit detection to particular formats, pass their keys from the [conversion formats](https://docs.invopop.com/api-ref/silo/gobl/convert-formats.md) endpoint in the `format` query parameter.

To store the result as a new silo entry, use [import an entry](https://docs.invopop.com/api-ref/silo/entries/import-an-entry-post.md) instead, which also keeps the original document and its attachments as files of the entry.


## OpenAPI

````yaml POST /silo/v1/gobl/convert/import
openapi: 3.0.0
info:
  contact:
    email: dev@invopop.com
    name: Invopop Developers
  description: >-
    Store and manage GOBL documents along with their attachments in "Silo
    Entries".
  license:
    name: Apache 2.0
    url: http://www.apache.org/licenses/LICENSE-2.0.html
  title: Silo Service API
  version: 1.0.0
servers:
  - description: production
    url: https://api.invopop.com
security:
  - authToken: []
paths:
  /silo/v1/gobl/convert/import:
    post:
      description: >-
        Convert a document in an external format, such as UBL or CII, into a
        GOBL Envelope without persisting anything. Send the raw document as the
        request body; its format is detected automatically. Any files embedded
        in the document are returned as attachments. Requests up to 100MB are
        accepted.
      parameters:
        - description: >-
            Keys of the formats to limit detection to. When omitted, the format
            is detected from the document.
          in: query
          name: format
          schema:
            description: >-
              Keys of the formats to limit detection to. When omitted, the
              format is detected from the document.
            example:
              - ubl+peppol+bis-v3
            items:
              type: string
            title: Format
            type: array
      requestBody:
        content:
          application/octet-stream:
            schema:
              format: binary
              type: string
        description: Raw document to import.
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SiloImportedGOBL'
          description: OK
components:
  schemas:
    SiloImportedGOBL:
      properties:
        attachments:
          description: Files embedded in the document.
          items:
            $ref: '#/components/schemas/SiloConvertAttachment'
          title: Attachments
          type: array
        data:
          description: GOBL Envelope built from the document.
          nullable: true
          title: Data
          type: object
        format:
          description: Key of the format detected.
          example: ubl+peppol+bis-v3
          title: Format
          type: string
      type: object
    SiloConvertAttachment:
      properties:
        data:
          $ref: '#/components/schemas/SiloBase64'
        desc:
          description: Description of the file.
          title: Description
          type: string
        id:
          description: Identifies the attachment inside the document.
          title: ID
          type: string
        mime:
          description: MIME type of the file.
          example: application/pdf
          title: MIME
          type: string
        name:
          description: Name of the file.
          example: invoice.pdf
          title: Name
          type: string
        size:
          description: Size of the file in bytes.
          example: 12345
          title: Size
          type: integer
      type: object
    SiloBase64:
      description: Base64 encoded binary data.
      format: byte
      type: string
  securitySchemes:
    authToken:
      bearerFormat: JWT
      description: >-
        Use the `Bearer` scheme with a valid JWT token to authenticate requests.
        Example: `Authorization: Bearer <token>`
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.