Documents

Attach document URLs

You can import documents to Document Projects by linking them from external storages. The linked documents are displayed in SuperAnnotate, but they aren't stored in our local servers. For that, you need to enable CORS in your storage or enable the CORS Unblock extension.

Enable CORS

Step 1: Enable CORS in your storage

Enable Cross-Origin Resource Sharing (CORS) for the storages you'll be using. See how.

Step 2: Create a CSV file containing the document URLs

Create a CSV file that contains the document URLs. Use this template CSV file as a reference.

KeyRequired/OptionalValue
urlRequiredDocument URL
nameOptionalDocument name

📘

If the document name field is empty, a name ID will be generated based on the row ID and a random UUID.

Step 3: Attach document URLs via Python SDK

Attach the documents to your project with this SDK command.

sa.attach_items(
    project = "Project Name", 
    attachments = "./documents.csv",
    annotation_status = "QualityCheck")
superannotatecli attach-document-urls --project “Project Name/Folder Name” --attachments “./documents.csv” --annotation_status “QualityCheck”

Enable the CORS Unblock extension

To use the Document Editor, you need to install and enable the CORS Unblock extension:

  1. Install the CORS Unblock extension.
  2. Pin the extension.
  3. When you go to the Document Editor, right-click on the extension.
  4. Hover over This Can Read and Change Site Data.
  5. Select the Document Editor’s link.

How to enable CORS

Amazon S3 bucket

  1. Go to your bucket.
  2. Go to Permissions.
  3. Turn off Block all public access.
  4. Insert this configuration in the CORS section.
[
    {
        "AllowedHeaders": [],
        "AllowedMethods": [
            "GET"
        ],
        "AllowedOrigins": [
            "*"
        ],
        "ExposeHeaders": []
    }
]
  1. Click Save changes.

GCP storage

Learn how to configure CORS here on a GCP cloud storage bucket.

In Step 2, you need to use the gsutil cors command to apply the configuration to your bucket. Find it below.

[
    {
        "origin": [
            "https://*.superannotate.com"
        ],
        "method": [
            "GET"
        ],
        "maxAgeSeconds": 3600
    }
]

Azure blob storage

  1. Go to your Azure portal.
  2. Select Storage accounts.
  3. Go to your container.
  4. Under Settings, select Resource sharing (CORS).
  5. In the Blob service tab, set the values of these fields:
    • Allowed origins: https://*.superannotate.com
    • Allowed methods: GET
    • Max age: preferred max age value in seconds. The value should be larger than 0. The standard value is 3600.

Upload documents from an integrated cloud storage

To upload documents from an integrated cloud storage:

sa.attach_items_from_integrated_storage(
   project= "Project Name",
   integration= {integration_meta},
   folder_path= "storage_folder_name")

Learn how to create integrations.