Skip to main content
Custom embeddings are required for similarity search on items already in Encord, embedding plots, and filtering. Natural language search and search by uploaded image are different. When someone types a query or drops in an image, that query has to be turned into a vector in the same embedding space as your imported embeddings, at the moment they search. Encord’s built-in model cannot produce vectors in your model’s space, so you host a small endpoint that runs your model, and Encord calls it at search time.
You can use any model, including open-weight models, as long as the vectors your endpoint returns come from the same model (and the same preprocessing) you used to create the embeddings you imported.

How It Works

The call to your endpoint is made from your browser, not from Encord’s servers. Encord’s backend signs a short-lived token for each user, the browser sends the query and token to your endpoint, and then sends the returned vector to Encord to run the search. This has three consequences for how you deploy your endpoint:
  • Network access: your endpoint must be reachable from the browsers of everyone who searches in Encord. There is no fixed Encord IP address to allowlist. An internet-facing endpoint works for everyone; an endpoint on your internal network or VPN works only for users connected to it.
  • CORS: because the request comes from a browser, your endpoint must answer CORS preflight requests from the Encord app.
  • Authentication: you authenticate requests by verifying the signed token, not by IP address or a shared secret.

Before You Begin

  • Your custom embeddings are imported and enabled on your top-level folder.
  • You have the embedding key you added to your metadata schema (for example, my-model-embedding) and its size.
  • You are an Admin of your Encord Organization (needed to create a service integration).
  • You can host an HTTPS endpoint that runs your model.

Step 1: Build Your Endpoint

Your endpoint accepts a POST request with a JSON body and returns the embedding as a JSON array of numbers.

Request

Response

Return HTTP 200 with a JSON array of numbers:
  • The array length must match the size of the embedding in your metadata schema.
  • Normalize the vector the same way you normalized your imported embeddings.
  • Any status other than 200, or a body that is not an array of numbers, is shown to the user as a failed search.

CORS

Allow the Encord app origin to call your endpoint. Your endpoint must respond to the OPTIONS preflight with at least:
Use https://app.us.encord.com if your Organization is on the US platform.

Step 2: Verify Every Request

Every request carries Authorization: Bearer <token>, a JWT signed by Encord. Reject any request whose token does not verify. The token also includes a sub claim containing the email address of the Encord user who ran the search, which you can use for logging or per-user access control. Public keys (JWKS):
An OpenID discovery document is also available, for libraries that support it:
  • US platform: replace https://api.encord.com with https://api.us.encord.com in all the URLs above.
  • Your Encord representative can confirm your <organisation-id> and the exact issuer URL during setup.
  • Cache the JWKS response rather than fetching it on every request.

Step 3: Create a Service Integration

A service integration holds the key pair Encord uses to sign tokens for your endpoint.
  1. Go to your Workspace Organization settings and select Service integrations.
  2. Click New service integration.
  3. Enter:
    • Title: A meaningful name for the integration. For example Embedding search.
    • Target domain: The origin of your endpoint including https://, for example https://embed.example.com. Do not include the path; you send that separately in Step 4. This value is also the token’s aud claim.
    • Signing algorithm: EdDSA (Ed25519) is recommended. Choose ES256 only if your JWT library does not support EdDSA.
  4. Click Create service integration.
  5. Copy the UUID shown next to the integration’s title. You can also click Download public key if you prefer to pin the key instead of using the JWKS URL.

Step 4: Send Your Details to Encord

Send your Encord contact:
  • The service integration UUID from Step 3.
  • Your embedding key (for example, my-model-embedding).
  • The endpoint path (for example, /v1/embed). Encord combines it with your Target domain to form the full URL, so https://embed.example.com + /v1/embed becomes https://embed.example.com/v1/embed.
  • Whether your endpoint supports text, images, or both.
Encord connects your embedding key to your endpoint. After that, your custom embedding offers text and image search.
  1. Go to Data > Explore and select your top-level folder.
  2. Select your custom embedding from the Embedding selector.
  3. Type a search query, or upload an image.
If results don’t appear, open your browser’s developer tools and check the Network tab for the request to your endpoint.

Example Endpoint (Python)

This example uses FastAPI and PyJWT. Replace my_model with your own model code.

Troubleshooting