Getting started
Back to home
Getting started

Detect a framework

Inspect the repository and optional root directory to suggest a framework and build settings.

POST/api/customer/v1/source/detect-framework

Request body

Send JSON with Content-Type: application/json. Nested fields and accepted values are listed in the schema.

FieldTypeRequired
repositoryUrlstringNo
branchstringNo
rootDirectorystringNo
installationIdintegerNo
uploadIdstringNo
projectIdstringNo
Full request schema
{
  "type": "object",
  "properties": {
    "repositoryUrl": {
      "type": "string"
    },
    "branch": {
      "type": "string"
    },
    "rootDirectory": {
      "type": "string"
    },
    "installationId": {
      "type": "integer",
      "minimum": 1
    },
    "uploadId": {
      "type": "string",
      "minLength": 1
    },
    "projectId": {
      "type": "string",
      "minLength": 1
    }
  },
  "required": [],
  "additionalProperties": false
}

Example request

Set HCODE_BASE_URL and HCODE_API_KEY as shown in Getting started. Replace resource variables with your own IDs.

curl --request POST "$HCODE_BASE_URL/api/customer/v1/source/detect-framework" \
  --header "Authorization: Bearer $HCODE_API_KEY" \
  --header "Content-Type: application/json" \
  --data '{
  "repositoryUrl": "https://github.com/example/app"
}'

Response

The JSON shape is defined in the response schema.

Response schema
{
  "anyOf": [
    {
      "type": "object",
      "properties": {
        "detected": {
          "type": "boolean"
        },
        "framework": {
          "type": "object",
          "properties": {
            "name": {
              "type": "string"
            },
            "installCommand": {
              "type": "string"
            },
            "buildCommand": {
              "type": "string"
            },
            "startCommand": {
              "type": "string"
            },
            "outputDirectory": {
              "type": "string"
            },
            "port": {
              "type": "integer"
            }
          },
          "required": [
            "name",
            "installCommand",
            "buildCommand",
            "startCommand",
            "outputDirectory"
          ],
          "additionalProperties": true
        },
        "runtimeChoiceRequired": {
          "type": "boolean"
        },
        "runtimeChoiceReason": {
          "type": "string"
        },
        "runtimeOptions": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "authMode": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "rateLimitResetAt": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "fromCache": {
          "type": "boolean"
        }
      },
      "required": [
        "detected",
        "framework"
      ],
      "additionalProperties": true
    },
    {
      "type": "object",
      "properties": {
        "source": {
          "type": "string"
        },
        "dockerfile": {
          "type": "object",
          "properties": {
            "present": {
              "type": "boolean"
            },
            "path": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            "exposedPorts": {
              "type": "array",
              "items": {
                "type": "integer"
              }
            }
          },
          "required": [
            "present"
          ],
          "additionalProperties": true
        },
        "framework": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "packageManager": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "suggestedBuildMode": {
          "type": "string"
        },
        "suggestedStartCommand": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "suggestedPort": {
          "anyOf": [
            {
              "type": "integer"
            },
            {
              "type": "null"
            }
          ]
        },
        "suggestedRuntimeIntent": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ]
        },
        "workerLikely": {
          "type": "boolean"
        },
        "notes": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "confidence": {
          "type": "string"
        }
      },
      "required": [
        "source",
        "dockerfile",
        "suggestedBuildMode",
        "workerLikely",
        "confidence"
      ],
      "additionalProperties": true
    }
  ],
  "properties": {
    "operationId": {
      "type": "string"
    },
    "operations": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "href": {
            "type": "string"
          }
        },
        "required": [
          "id",
          "status",
          "href"
        ]
      }
    }
  }
}

See errors and retries for failure responses.